

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>argoverse.utils package &mdash; argoverse  documentation</title>
  

  
  
  
  

  
  <script type="text/javascript" src="_static/js/modernizr.min.js"></script>
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
        <script type="text/javascript" src="_static/jquery.js"></script>
        <script type="text/javascript" src="_static/underscore.js"></script>
        <script type="text/javascript" src="_static/doctools.js"></script>
        <script type="text/javascript" src="_static/language_data.js"></script>
    
    <script type="text/javascript" src="_static/js/theme.js"></script>

    

  
  <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="_static/graphviz.css" type="text/css" />
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="index.html" class="icon icon-home"> argoverse
          

          
          </a>

          
            
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <!-- Local TOC -->
              <div class="local-toc"><ul>
<li><a class="reference internal" href="#">argoverse.utils package</a><ul>
<li><a class="reference internal" href="#submodules">Submodules</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.bfs">argoverse.utils.bfs module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.calibration">argoverse.utils.calibration module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.camera_stats">argoverse.utils.camera_stats module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.centerline_utils">argoverse.utils.centerline_utils module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.city_visibility_utils">argoverse.utils.city_visibility_utils module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.cuboid_interior">argoverse.utils.cuboid_interior module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.cv2_plotting_utils">argoverse.utils.cv2_plotting_utils module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.datetime_utils">argoverse.utils.datetime_utils module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.dilation_utils">argoverse.utils.dilation_utils module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.ffmpeg_utils">argoverse.utils.ffmpeg_utils module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.forecasting_evaluation">argoverse.utils.forecasting_evaluation module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.frustum_clipping">argoverse.utils.frustum_clipping module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.geometry">argoverse.utils.geometry module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.grid_interpolation">argoverse.utils.grid_interpolation module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.helpers">argoverse.utils.helpers module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.heuristic_ground_removal">argoverse.utils.heuristic_ground_removal module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.interpolate">argoverse.utils.interpolate module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.json_utils">argoverse.utils.json_utils module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.line_projection">argoverse.utils.line_projection module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.manhattan_search">argoverse.utils.manhattan_search module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.mayavi_wrapper">argoverse.utils.mayavi_wrapper module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.mesh_grid">argoverse.utils.mesh_grid module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.mpl_plotting_utils">argoverse.utils.mpl_plotting_utils module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.pkl_utils">argoverse.utils.pkl_utils module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.plane_visualization_utils">argoverse.utils.plane_visualization_utils module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.ply_loader">argoverse.utils.ply_loader module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.polyline_density">argoverse.utils.polyline_density module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.se2">argoverse.utils.se2 module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.se3">argoverse.utils.se3 module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.subprocess_utils">argoverse.utils.subprocess_utils module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils.transform">argoverse.utils.transform module</a></li>
<li><a class="reference internal" href="#module-argoverse.utils">Module contents</a></li>
</ul>
</li>
</ul>
</div>
            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">argoverse</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="index.html">Docs</a> &raquo;</li>
        
      <li>argoverse.utils package</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="_sources/argoverse.utils.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="argoverse-utils-package">
<h1>argoverse.utils package<a class="headerlink" href="#argoverse-utils-package" title="Permalink to this headline">¶</a></h1>
<div class="section" id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-argoverse.utils.bfs">
<span id="argoverse-utils-bfs-module"></span><h2>argoverse.utils.bfs module<a class="headerlink" href="#module-argoverse.utils.bfs" title="Permalink to this headline">¶</a></h2>
<p>Breadth-First-Search of Graphs.</p>
<dl class="function">
<dt id="argoverse.utils.bfs.bfs_enumerate_paths">
<code class="sig-prename descclassname">argoverse.utils.bfs.</code><code class="sig-name descname">bfs_enumerate_paths</code><span class="sig-paren">(</span><em class="sig-param">graph</em>, <em class="sig-param">start</em>, <em class="sig-param">max_depth=4</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/bfs.html#bfs_enumerate_paths"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.bfs.bfs_enumerate_paths" title="Permalink to this definition">¶</a></dt>
<dd><p>Run Breadth-First-Search. Cycles are allowed and are accounted for.</p>
<p>Find (u,v) edges in E of graph (V,E)</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>graph</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Mapping" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Mapping</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Sequence" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sequence</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]]) – Python dictionary representing an adjacency list</p></li>
<li><p><strong>start</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – key representing hash of start/source node in the graph search</p></li>
<li><p><strong>max_depth</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – maximum depth to traverse in graph from start node</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>list of graph paths</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>all_paths</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.bfs.remove_duplicate_paths">
<code class="sig-prename descclassname">argoverse.utils.bfs.</code><code class="sig-name descname">remove_duplicate_paths</code><span class="sig-paren">(</span><em class="sig-param">paths</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/bfs.html#remove_duplicate_paths"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.bfs.remove_duplicate_paths" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove duplicate subpaths from a set of paths.</p>
<p>For example, if <code class="docutils literal notranslate"><span class="pre">['1',</span> <span class="pre">'2',</span> <span class="pre">'6']</span></code> and <code class="docutils literal notranslate"><span class="pre">['1',</span> <span class="pre">'2']</span></code> are
included, remove the latter.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>paths</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Sequence" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sequence</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Sequence" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sequence</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Any" title="(in Python v3.7)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Any</span></code></a>]]) – Python list of lists, each element is a node key.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Sequence" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sequence</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Sequence" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sequence</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]]</p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Python list of lists, each element is a node key</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.calibration">
<span id="argoverse-utils-calibration-module"></span><h2>argoverse.utils.calibration module<a class="headerlink" href="#module-argoverse.utils.calibration" title="Permalink to this headline">¶</a></h2>
<p>make util to project RGB values onto the point cloud</p>
<dl class="class">
<dt id="argoverse.utils.calibration.Calibration">
<em class="property">class </em><code class="sig-prename descclassname">argoverse.utils.calibration.</code><code class="sig-name descname">Calibration</code><span class="sig-paren">(</span><em class="sig-param">camera_config</em>, <em class="sig-param">calib</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/calibration.html#Calibration"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.calibration.Calibration" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<p>Calibration matrices and utils.</p>
<p>3d XYZ are in 3D egovehicle coord.
2d box xy are in image coord, normalized by width and height
Point cloud are in egovehicle coord</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">xy_image</span> <span class="o">=</span> <span class="n">K</span> <span class="o">*</span> <span class="p">[</span><span class="n">R</span><span class="o">|</span><span class="n">T</span><span class="p">]</span> <span class="o">*</span> <span class="n">xyz_ego</span>

<span class="n">xyz_image</span> <span class="o">=</span> <span class="p">[</span><span class="n">R</span><span class="o">|</span><span class="n">T</span><span class="p">]</span> <span class="o">*</span> <span class="n">xyz_ego</span>

<span class="n">image</span> <span class="n">coord</span><span class="p">:</span>
 <span class="o">----&gt;</span> <span class="n">x</span><span class="o">-</span><span class="n">axis</span> <span class="p">(</span><span class="n">u</span><span class="p">)</span>
<span class="o">|</span>
<span class="o">|</span>
<span class="n">v</span> <span class="n">y</span><span class="o">-</span><span class="n">axis</span> <span class="p">(</span><span class="n">v</span><span class="p">)</span>
</pre></div>
</div>
<p>egovehicle coord:
front x, left y, up z</p>
<dl class="method">
<dt id="argoverse.utils.calibration.Calibration.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">camera_config</em>, <em class="sig-param">calib</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/calibration.html#Calibration.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.calibration.Calibration.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a Calibration instance.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>camera_config</strong> (<a class="reference internal" href="#argoverse.utils.calibration.CameraConfig" title="argoverse.utils.calibration.CameraConfig"><code class="xref py py-class docutils literal notranslate"><span class="pre">CameraConfig</span></code></a>) – A camera config</p></li>
<li><p><strong>calib</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Dict" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Any" title="(in Python v3.7)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Any</span></code></a>]) – Calibration data</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="argoverse.utils.calibration.Calibration.cart2hom">
<code class="sig-name descname">cart2hom</code><span class="sig-paren">(</span><em class="sig-param">pts_3d</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/calibration.html#Calibration.cart2hom"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.calibration.Calibration.cart2hom" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert Cartesian coordinates to Homogeneous.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>pts_3d</strong> (<em>&lt;built-in function array&gt;</em>) – nx3 points in Cartesian</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>nx4 points in Homogeneous by appending 1</p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="argoverse.utils.calibration.Calibration.project_cam_to_ego">
<code class="sig-name descname">project_cam_to_ego</code><span class="sig-paren">(</span><em class="sig-param">pts_3d_rect</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/calibration.html#Calibration.project_cam_to_ego"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.calibration.Calibration.project_cam_to_ego" title="Permalink to this definition">¶</a></dt>
<dd><p>Project point in camera frame to egovehicle frame.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>pts_3d_rect</strong> (<em>np.array</em>) – nx3 points in cam coord.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>nx3 points in ego coord.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>np.array</p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="argoverse.utils.calibration.Calibration.project_ego_to_cam">
<code class="sig-name descname">project_ego_to_cam</code><span class="sig-paren">(</span><em class="sig-param">pts_3d_ego</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/calibration.html#Calibration.project_ego_to_cam"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.calibration.Calibration.project_ego_to_cam" title="Permalink to this definition">¶</a></dt>
<dd><p>Project egovehicle point onto camera frame.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>pts_3d_ego</strong> (<em>&lt;built-in function array&gt;</em>) – nx3 points in egovehicle coord.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>nx3 points in camera coord.</p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="argoverse.utils.calibration.Calibration.project_ego_to_image">
<code class="sig-name descname">project_ego_to_image</code><span class="sig-paren">(</span><em class="sig-param">pts_3d_ego</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/calibration.html#Calibration.project_ego_to_image"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.calibration.Calibration.project_ego_to_image" title="Permalink to this definition">¶</a></dt>
<dd><p>Project egovehicle coordinate to image.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>pts_3d_ego</strong> (<em>&lt;built-in function array&gt;</em>) – nx3 points in egovehicle coord</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>nx2 points in image coord</p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="argoverse.utils.calibration.Calibration.project_image_to_cam">
<code class="sig-name descname">project_image_to_cam</code><span class="sig-paren">(</span><em class="sig-param">uv_depth</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/calibration.html#Calibration.project_image_to_cam"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.calibration.Calibration.project_image_to_cam" title="Permalink to this definition">¶</a></dt>
<dd><p>Project 2D image with depth to camera coordinate.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>uv_depth</strong> (<em>&lt;built-in function array&gt;</em>) – nx3 first two channels are uv, 3rd channel
is depth in camera coord.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>nx3 points in camera coord.</p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="argoverse.utils.calibration.Calibration.project_image_to_ego">
<code class="sig-name descname">project_image_to_ego</code><span class="sig-paren">(</span><em class="sig-param">uv_depth</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/calibration.html#Calibration.project_image_to_ego"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.calibration.Calibration.project_image_to_ego" title="Permalink to this definition">¶</a></dt>
<dd><p>Project 2D image with depth to egovehicle coordinate.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>uv_depth</strong> (<em>&lt;built-in function array&gt;</em>) – nx3 first two channels are uv, 3rd channel
is depth in camera coord. So basically in image coordinate.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>nx3 points in ego coord.</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="argoverse.utils.calibration.CameraConfig">
<em class="property">class </em><code class="sig-prename descclassname">argoverse.utils.calibration.</code><code class="sig-name descname">CameraConfig</code><span class="sig-paren">(</span><em class="sig-param">extrinsic</em>, <em class="sig-param">intrinsic</em>, <em class="sig-param">img_width</em>, <em class="sig-param">img_height</em>, <em class="sig-param">distortion_coeffs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/calibration.html#CameraConfig"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.calibration.CameraConfig" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<p>Camera config for extrinsic matrix, intrinsic matrix, image width/height.</p>
<dl class="method">
<dt id="argoverse.utils.calibration.CameraConfig.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">extrinsic</em>, <em class="sig-param">intrinsic</em>, <em class="sig-param">img_width</em>, <em class="sig-param">img_height</em>, <em class="sig-param">distortion_coeffs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/calibration.html#CameraConfig.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.calibration.CameraConfig.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>extrinsic</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – extrinsic matrix</p></li>
<li><p><strong>intrinsic</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – intrinsic matrix</p></li>
<li><p><strong>img_width</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – image width</p></li>
<li><p><strong>img_height</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – image height</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="function">
<dt id="argoverse.utils.calibration.determine_valid_cam_coords">
<code class="sig-prename descclassname">argoverse.utils.calibration.</code><code class="sig-name descname">determine_valid_cam_coords</code><span class="sig-paren">(</span><em class="sig-param">uv</em>, <em class="sig-param">uv_cam</em>, <em class="sig-param">camera_config</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/calibration.html#determine_valid_cam_coords"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.calibration.determine_valid_cam_coords" title="Permalink to this definition">¶</a></dt>
<dd><p>Given a set of coordinates in the image plane and corresponding points
in the camera coordinate reference frame, determine those points
that have a valid projection into the image. 3d points with valid
projections have x coordinates in the range [0,img_width-1], y-coordinates
in the range [0,img_height-1], and a positive z-coordinate (lying in
front of the camera frustum).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>uv</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (N,2)</p></li>
<li><p><strong>uv_cam</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (N,3)</p></li>
<li><p><strong>camera_config</strong> (<a class="reference internal" href="#argoverse.utils.calibration.CameraConfig" title="argoverse.utils.calibration.CameraConfig"><code class="xref py py-class docutils literal notranslate"><span class="pre">CameraConfig</span></code></a>) – A camera configuration</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Numpy array of shape (N,) with dtype bool</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.calibration.distort_single">
<code class="sig-prename descclassname">argoverse.utils.calibration.</code><code class="sig-name descname">distort_single</code><span class="sig-paren">(</span><em class="sig-param">radius_undist</em>, <em class="sig-param">distort_coeffs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/calibration.html#distort_single"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.calibration.distort_single" title="Permalink to this definition">¶</a></dt>
<dd><p>Calculate distortion for a single undistorted radius.
Note that we have 3 distortion parameters.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>radius_undist</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) – undistorted radius</p></li>
<li><p><strong>distort_coeffs</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.List" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">List</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>]) – list of distortion coefficients</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>distortion radius</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.calibration.get_calibration_config">
<code class="sig-prename descclassname">argoverse.utils.calibration.</code><code class="sig-name descname">get_calibration_config</code><span class="sig-paren">(</span><em class="sig-param">calibration</em>, <em class="sig-param">camera_name</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/calibration.html#get_calibration_config"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.calibration.get_calibration_config" title="Permalink to this definition">¶</a></dt>
<dd><p>Get calibration config dumped with log.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>calibration</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Dict" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Any" title="(in Python v3.7)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Any</span></code></a>]) – </p></li>
<li><p><strong>camera_name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – name of the camera.</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#argoverse.utils.calibration.CameraConfig" title="argoverse.utils.calibration.CameraConfig"><code class="xref py py-class docutils literal notranslate"><span class="pre">CameraConfig</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>instance of CameraConfig class</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.calibration.get_camera_extrinsic_matrix">
<code class="sig-prename descclassname">argoverse.utils.calibration.</code><code class="sig-name descname">get_camera_extrinsic_matrix</code><span class="sig-paren">(</span><em class="sig-param">config</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/calibration.html#get_camera_extrinsic_matrix"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.calibration.get_camera_extrinsic_matrix" title="Permalink to this definition">¶</a></dt>
<dd><p>Load camera calibration rotation and translation.</p>
<dl class="simple">
<dt>Note that the camera calibration file contains the SE3 for sensor frame to the vehicle frame, i.e.</dt><dd><p>pt_egovehicle = egovehicle_SE3_sensor * pt_sensor</p>
</dd>
</dl>
<p>Then build extrinsic matrix from rotation matrix and translation, a member
of SE3. Then we return the inverse of the SE3 transformation.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>config</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Dict" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Any" title="(in Python v3.7)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Any</span></code></a>]) – Calibration config in json, or calibration file path.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Camera rotation and translation matrix.</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.calibration.get_camera_intrinsic_matrix">
<code class="sig-prename descclassname">argoverse.utils.calibration.</code><code class="sig-name descname">get_camera_intrinsic_matrix</code><span class="sig-paren">(</span><em class="sig-param">camera_config</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/calibration.html#get_camera_intrinsic_matrix"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.calibration.get_camera_intrinsic_matrix" title="Permalink to this definition">¶</a></dt>
<dd><p>Load camera calibration data and constructs intrinsic matrix.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>camera_config</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Dict" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Any" title="(in Python v3.7)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Any</span></code></a>]) – Calibration config in json</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Camera intrinsic matrix.</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.calibration.load_calib">
<code class="sig-prename descclassname">argoverse.utils.calibration.</code><code class="sig-name descname">load_calib</code><span class="sig-paren">(</span><em class="sig-param">calib_filepath</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/calibration.html#load_calib"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.calibration.load_calib" title="Permalink to this definition">¶</a></dt>
<dd><p>Load Calibration object for all camera from calibration filepath</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>calib_filepath</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – path to the calibration file</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Dict" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Any" title="(in Python v3.7)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Any</span></code></a>, <a class="reference internal" href="#argoverse.utils.calibration.Calibration" title="argoverse.utils.calibration.Calibration"><code class="xref py py-class docutils literal notranslate"><span class="pre">Calibration</span></code></a>]</p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>list of Calibration object for all cameras</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.calibration.load_image">
<code class="sig-prename descclassname">argoverse.utils.calibration.</code><code class="sig-name descname">load_image</code><span class="sig-paren">(</span><em class="sig-param">img_filename</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/calibration.html#load_image"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.calibration.load_image" title="Permalink to this definition">¶</a></dt>
<dd><p>Load image.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>img_filename</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Image file name</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Image data</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.calibration.point_cloud_to_homogeneous">
<code class="sig-prename descclassname">argoverse.utils.calibration.</code><code class="sig-name descname">point_cloud_to_homogeneous</code><span class="sig-paren">(</span><em class="sig-param">points</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/calibration.html#point_cloud_to_homogeneous"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.calibration.point_cloud_to_homogeneous" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>points</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (N,3)</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Numpy array of shape (N,4)</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.calibration.proj_cam_to_uv">
<code class="sig-prename descclassname">argoverse.utils.calibration.</code><code class="sig-name descname">proj_cam_to_uv</code><span class="sig-paren">(</span><em class="sig-param">uv_cam</em>, <em class="sig-param">camera_config</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/calibration.html#proj_cam_to_uv"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.calibration.proj_cam_to_uv" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>, <a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>, <a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>, <a class="reference internal" href="#argoverse.utils.calibration.CameraConfig" title="argoverse.utils.calibration.CameraConfig"><code class="xref py py-class docutils literal notranslate"><span class="pre">CameraConfig</span></code></a>]</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.calibration.project_lidar_to_img">
<code class="sig-prename descclassname">argoverse.utils.calibration.</code><code class="sig-name descname">project_lidar_to_img</code><span class="sig-paren">(</span><em class="sig-param">lidar_points_h</em>, <em class="sig-param">calib_data</em>, <em class="sig-param">camera_name</em>, <em class="sig-param">return_camera_config=False</em>, <em class="sig-param">remove_nan=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/calibration.html#project_lidar_to_img"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.calibration.project_lidar_to_img" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>lidar_points_h</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (4,N)</p></li>
<li><p><strong>calib_data</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Dict" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Any" title="(in Python v3.7)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Any</span></code></a>]) – calibration data</p></li>
<li><p><strong>camera_name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – representing name of this camera sensor</p></li>
<li><p><strong>return_camera_config</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – adds camera config to the return tuple</p></li>
<li><p><strong>remove_nan</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – filter out nan values from uv and uv_cam</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Numpy array of shape (N,2) with dtype np.float32
uv_cam: Numpy array of shape (3,N) with dtype np.float32
valid_pts_bool: Numpy array of shape (N,) with dtype bool</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>uv</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.calibration.project_lidar_to_img_motion_compensated">
<code class="sig-prename descclassname">argoverse.utils.calibration.</code><code class="sig-name descname">project_lidar_to_img_motion_compensated</code><span class="sig-paren">(</span><em class="sig-param">pts_h_lidar_time</em>, <em class="sig-param">calib_data</em>, <em class="sig-param">camera_name</em>, <em class="sig-param">cam_timestamp</em>, <em class="sig-param">lidar_timestamp</em>, <em class="sig-param">dataset_dir</em>, <em class="sig-param">log_id</em>, <em class="sig-param">return_K=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/calibration.html#project_lidar_to_img_motion_compensated"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.calibration.project_lidar_to_img_motion_compensated" title="Permalink to this definition">¶</a></dt>
<dd><p>Because of the high frame rate, motion compensation’s role between the
sensors is not very significant, moving points only by millimeters
to centimeters. If the vehicle is moving at 25 miles per hour, equivalent
to 11 meters/sec, then in 17 milliseconds (the max time between a lidar sweep
and camera image capture) we should be able to move up to 187 millimeters.</p>
<dl class="simple">
<dt>This can be verified in practice as the mean_change:</dt><dd><p>mean_change = np.amax(pts_h_cam_time.T[:,:3] - pts_h_lidar_time ,axis=0)</p>
</dd>
</dl>
<p>Adjust LiDAR points for ego-vehicle motion. This function accepts the
egovehicle’s pose in the city map both at camera time and also at
the LiDAR time.</p>
<p>We perform the following transformation, where “ego” stands for
egovehicle reference frame</p>
<blockquote>
<div><p>pt_ego_cam_t = ego_cam_t_SE3_map * map_SE3_ego_lidar_t * pt_ego_lidar_t</p>
</div></blockquote>
<p>Note that both “cam_time_pts_h” and “lidar_time_pts_h” are 3D points in the
vehicle coordinate frame, but captured at different times. These LiDAR points
always live in the vehicle frame, but just in different timestamps. If we take
a lidar point in the egovehicle frame, captured at lidar time, and bring it into
the map at this lidar timestamp, then we know the transformation from map to
egovehicle reference frame at the time when the camera image was captured.</p>
<p>Thus, we move from egovehicle &#64; lidar time, to the map (which is time agnostic),
then we move from map to egovehicle &#64;camera time. Now we suddenly have lidar points
living in the egovehicle frame &#64; camera time.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>pts_h_lidar_time</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (4,N)</p></li>
<li><p><strong>calib_data</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Dict" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Any" title="(in Python v3.7)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Any</span></code></a>]) – Python dictionary</p></li>
<li><p><strong>camera_name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – string, representing name of camera</p></li>
<li><p><strong>cam_timestamp</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – integer, representing time in nanoseconds when
camera image was recorded</p></li>
<li><p><strong>lidar_timestamp</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – integer, representing time in nanoseconds when
LiDAR sweep was recorded</p></li>
<li><p><strong>dataset_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – string, representing path to where dataset is stored</p></li>
<li><p><strong>log_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – string, representing unique ID of vehicle log</p></li>
<li><p><strong>return_K</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – return a copy of the</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Numpy array of shape (N,2) with dtype np.float32
uv_cam: Numpy array of shape (N,3) with dtype np.float32
valid_pts_bool: Numpy array of shape (N,) with dtype bool</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>uv</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.calibration.project_lidar_to_undistorted_img">
<code class="sig-prename descclassname">argoverse.utils.calibration.</code><code class="sig-name descname">project_lidar_to_undistorted_img</code><span class="sig-paren">(</span><em class="sig-param">lidar_points_h</em>, <em class="sig-param">calib_data</em>, <em class="sig-param">camera_name</em>, <em class="sig-param">remove_nan=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/calibration.html#project_lidar_to_undistorted_img"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.calibration.project_lidar_to_undistorted_img" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>, <a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>, <a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>, <a class="reference internal" href="#argoverse.utils.calibration.CameraConfig" title="argoverse.utils.calibration.CameraConfig"><code class="xref py py-class docutils literal notranslate"><span class="pre">CameraConfig</span></code></a>]</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.calibration.remove_nan_values">
<code class="sig-prename descclassname">argoverse.utils.calibration.</code><code class="sig-name descname">remove_nan_values</code><span class="sig-paren">(</span><em class="sig-param">uv</em>, <em class="sig-param">uv_cam</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/calibration.html#remove_nan_values"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.calibration.remove_nan_values" title="Permalink to this definition">¶</a></dt>
<dd><p>Accept corrupt array</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>, <a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>]</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.camera_stats">
<span id="argoverse-utils-camera-stats-module"></span><h2>argoverse.utils.camera_stats module<a class="headerlink" href="#module-argoverse.utils.camera_stats" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="argoverse.utils.camera_stats.get_image_dims_for_camera">
<code class="sig-prename descclassname">argoverse.utils.camera_stats.</code><code class="sig-name descname">get_image_dims_for_camera</code><span class="sig-paren">(</span><em class="sig-param">camera_name</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/camera_stats.html#get_image_dims_for_camera"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.camera_stats.get_image_dims_for_camera" title="Permalink to this definition">¶</a></dt>
<dd><p>Get image dimensions for camera.
:type camera_name: <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>
:param camera_name: Camera name.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.7)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>], <a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.7)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]]</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Tuple of [img_width, image_height] in pixels</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.centerline_utils">
<span id="argoverse-utils-centerline-utils-module"></span><h2>argoverse.utils.centerline_utils module<a class="headerlink" href="#module-argoverse.utils.centerline_utils" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="argoverse.utils.centerline_utils.centerline_to_polygon">
<code class="sig-prename descclassname">argoverse.utils.centerline_utils.</code><code class="sig-name descname">centerline_to_polygon</code><span class="sig-paren">(</span><em class="sig-param">centerline</em>, <em class="sig-param">width_scaling_factor=1.0</em>, <em class="sig-param">visualize=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/centerline_utils.html#centerline_to_polygon"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.centerline_utils.centerline_to_polygon" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert a lane centerline polyline into a rough polygon of the lane’s area.</p>
<p>On average, a lane is 3.8 meters in width. Thus, we allow 1.9 m on each side.
We use this as the length of the hypotenuse of a right triangle, and compute the
other two legs to find the scaled x and y displacement.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>centerline</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (N,2).</p></li>
<li><p><strong>width_scaling_factor</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) – Multiplier that scales 3.8 meters to get the lane width.</p></li>
<li><p><strong>visualize</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – Save a figure showing the the output polygon.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Numpy array of shape (2N+1,2), with duplicate first and last vertices.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>polygon</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.centerline_utils.convert_lane_boundaries_to_polygon">
<code class="sig-prename descclassname">argoverse.utils.centerline_utils.</code><code class="sig-name descname">convert_lane_boundaries_to_polygon</code><span class="sig-paren">(</span><em class="sig-param">right_lane_bounds</em>, <em class="sig-param">left_lane_bounds</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/centerline_utils.html#convert_lane_boundaries_to_polygon"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.centerline_utils.convert_lane_boundaries_to_polygon" title="Permalink to this definition">¶</a></dt>
<dd><p>Take a left and right lane boundary and make a polygon of the lane segment, closing both ends of the segment.</p>
<p>These polygons have the last vertex repeated (that is, first vertex == last vertex).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>right_lane_bounds</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Right lane boundary points. Shape is (N, 2).</p></li>
<li><p><strong>left_lane_bounds</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Left lane boundary points.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Numpy array of shape (2N+1,2)</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>polygon</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.centerline_utils.filter_candidate_centerlines">
<code class="sig-prename descclassname">argoverse.utils.centerline_utils.</code><code class="sig-name descname">filter_candidate_centerlines</code><span class="sig-paren">(</span><em class="sig-param">xy</em>, <em class="sig-param">candidate_cl</em>, <em class="sig-param">stationary_threshold=2.0</em>, <em class="sig-param">max_dist_margin=2.0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/centerline_utils.html#filter_candidate_centerlines"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.centerline_utils.filter_candidate_centerlines" title="Permalink to this definition">¶</a></dt>
<dd><p>Filter candidate centerlines based on the distance travelled along the centerline.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>xy</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Trajectory coordinates.</p></li>
<li><p><strong>candidate_cl</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.List" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">List</span></code></a>[<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>]) – List of candidate centerlines.</p></li>
<li><p><strong>stationary_threshold</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) – minimum displacement to be called as non-stationary.</p></li>
<li><p><strong>max_dist_margin</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) – </p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>filtered list of candidate centerlines</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>filtered_candidate_centerlines</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.centerline_utils.get_centerlines_most_aligned_with_trajectory">
<code class="sig-prename descclassname">argoverse.utils.centerline_utils.</code><code class="sig-name descname">get_centerlines_most_aligned_with_trajectory</code><span class="sig-paren">(</span><em class="sig-param">xy</em>, <em class="sig-param">candidate_cl</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/centerline_utils.html#get_centerlines_most_aligned_with_trajectory"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.centerline_utils.get_centerlines_most_aligned_with_trajectory" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the centerline from candidate_cl along which the trajectory travelled maximum distance</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>xy</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Trajectory coordinates</p></li>
<li><p><strong>candidate_cl</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.List" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">List</span></code></a>[<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>]) – List of candidate centerlines</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>centerlines along which distance travelled is maximum</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>candidate_centerlines</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.centerline_utils.get_normal_and_tangential_distance_point">
<code class="sig-prename descclassname">argoverse.utils.centerline_utils.</code><code class="sig-name descname">get_normal_and_tangential_distance_point</code><span class="sig-paren">(</span><em class="sig-param">x</em>, <em class="sig-param">y</em>, <em class="sig-param">centerline</em>, <em class="sig-param">delta=0.01</em>, <em class="sig-param">last=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/centerline_utils.html#get_normal_and_tangential_distance_point"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.centerline_utils.get_normal_and_tangential_distance_point" title="Permalink to this definition">¶</a></dt>
<dd><p>Get normal (offset from centerline) and tangential (distance along centerline) for the given point,
along the given centerline</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>x</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) – x-coordinate in map frame</p></li>
<li><p><strong>y</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) – y-coordinate in map frame</p></li>
<li><p><strong>centerline</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – centerline along which n-t is to be computed</p></li>
<li><p><strong>delta</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) – Used in computing offset direction</p></li>
<li><p><strong>last</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – True if point is the last coordinate of the trajectory</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>tangential and normal distances</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>(tang_dist, norm_dist)</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.centerline_utils.get_nt_distance">
<code class="sig-prename descclassname">argoverse.utils.centerline_utils.</code><code class="sig-name descname">get_nt_distance</code><span class="sig-paren">(</span><em class="sig-param">xy</em>, <em class="sig-param">centerline</em>, <em class="sig-param">viz=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/centerline_utils.html#get_nt_distance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.centerline_utils.get_nt_distance" title="Permalink to this definition">¶</a></dt>
<dd><p>Get normal (offset from centerline) and tangential (distance along centerline) distances for the given xy trajectory,
along the given centerline.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>xy</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Sequence of x,y,z coordinates.</p></li>
<li><p><strong>centerline</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – centerline along which n-t is to be computed</p></li>
<li><p><strong>viz</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – True if you want to visualize the computed centerlines.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>normal (offset from centerline) and tangential (distance along centerline) distances.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>nt_distance</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.centerline_utils.get_oracle_from_candidate_centerlines">
<code class="sig-prename descclassname">argoverse.utils.centerline_utils.</code><code class="sig-name descname">get_oracle_from_candidate_centerlines</code><span class="sig-paren">(</span><em class="sig-param">candidate_centerlines</em>, <em class="sig-param">xy</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/centerline_utils.html#get_oracle_from_candidate_centerlines"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.centerline_utils.get_oracle_from_candidate_centerlines" title="Permalink to this definition">¶</a></dt>
<dd><p>Get oracle centerline from candidate centerlines. Chose based on direction of travel and maximum offset.
First find the centerlines along which the distance travelled is close to maximum.
If there are multiple candidates, then chose the one which has minimum max offset</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>candidate_centerlines</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.List" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">List</span></code></a>[<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>]) – List of candidate centerlines</p></li>
<li><p><strong>xy</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Trajectory coordinates</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Oracle centerline</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>oracle_centerline</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.centerline_utils.is_overlapping_lane_seq">
<code class="sig-prename descclassname">argoverse.utils.centerline_utils.</code><code class="sig-name descname">is_overlapping_lane_seq</code><span class="sig-paren">(</span><em class="sig-param">lane_seq1</em>, <em class="sig-param">lane_seq2</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/centerline_utils.html#is_overlapping_lane_seq"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.centerline_utils.is_overlapping_lane_seq" title="Permalink to this definition">¶</a></dt>
<dd><p>Check if the 2 lane sequences are overlapping.
Overlapping is defined as:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">s1</span><span class="o">------</span><span class="n">s2</span><span class="o">-----------------</span><span class="n">e1</span><span class="o">--------</span><span class="n">e2</span>
</pre></div>
</div>
<p>Here lane2 starts somewhere on lane 1 and ends after it, OR:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">s1</span><span class="o">------</span><span class="n">s2</span><span class="o">-----------------</span><span class="n">e2</span><span class="o">--------</span><span class="n">e1</span>
</pre></div>
</div>
<p>Here lane2 starts somewhere on lane 1 and ends before it</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>lane_seq1</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Sequence" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sequence</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]) – list of lane ids</p></li>
<li><p><strong>lane_seq2</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Sequence" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sequence</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]) – list of lane ids</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>bool, True if the lane sequences overlap</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.centerline_utils.lane_waypt_to_query_dist">
<code class="sig-prename descclassname">argoverse.utils.centerline_utils.</code><code class="sig-name descname">lane_waypt_to_query_dist</code><span class="sig-paren">(</span><em class="sig-param">query_xy_city_coords</em>, <em class="sig-param">nearby_lane_objs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/centerline_utils.html#lane_waypt_to_query_dist"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.centerline_utils.lane_waypt_to_query_dist" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute the distance from a query to the closest waypoint in nearby lanes.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>query_xy_city_coords</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (2,)</p></li>
<li><p><strong>nearby_lane_objs</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.List" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">List</span></code></a>[<a class="reference internal" href="argoverse.map_representation.html#argoverse.map_representation.lane_segment.LaneSegment" title="argoverse.map_representation.lane_segment.LaneSegment"><code class="xref py py-class docutils literal notranslate"><span class="pre">LaneSegment</span></code></a>]) – list of LaneSegment objects</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>, <a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>, <a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>]</p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Tuple of (per_lane_dists, min_dist_nn_indices, dense_centerlines); all numpy arrays</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.centerline_utils.remove_overlapping_lane_seq">
<code class="sig-prename descclassname">argoverse.utils.centerline_utils.</code><code class="sig-name descname">remove_overlapping_lane_seq</code><span class="sig-paren">(</span><em class="sig-param">lane_seqs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/centerline_utils.html#remove_overlapping_lane_seq"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.centerline_utils.remove_overlapping_lane_seq" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove lane sequences which are overlapping to some extent</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>lane_seqs</strong> (<em>list of list of integers</em>) – List of sequence of lane ids (Eg. [[12345, 12346, 12347], [12345, 12348]])</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.List" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">List</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Sequence" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sequence</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]]</p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>List of sequence of lane ids (e.g. <code class="docutils literal notranslate"><span class="pre">[[12345,</span> <span class="pre">12346,</span> <span class="pre">12347],</span> <span class="pre">[12345,</span> <span class="pre">12348]]</span></code>)</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.centerline_utils.swap_left_and_right">
<code class="sig-prename descclassname">argoverse.utils.centerline_utils.</code><code class="sig-name descname">swap_left_and_right</code><span class="sig-paren">(</span><em class="sig-param">condition</em>, <em class="sig-param">left_centerline</em>, <em class="sig-param">right_centerline</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/centerline_utils.html#swap_left_and_right"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.centerline_utils.swap_left_and_right" title="Permalink to this definition">¶</a></dt>
<dd><p>Swap points in left and right centerline according to condition.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>condition</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (N,) of type boolean. Where true, swap the values in the left and
right centerlines.</p></li>
<li><p><strong>left_centerline</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – The left centerline, whose points should be swapped with the right centerline.</p></li>
<li><p><strong>right_centerline</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – The right centerline.</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Iterable" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Iterable</span></code></a>[<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>]</p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>left_centerline
right_centerline</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.city_visibility_utils">
<span id="argoverse-utils-city-visibility-utils-module"></span><h2>argoverse.utils.city_visibility_utils module<a class="headerlink" href="#module-argoverse.utils.city_visibility_utils" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="argoverse.utils.city_visibility_utils.clip_point_cloud_to_visible_region">
<code class="sig-prename descclassname">argoverse.utils.city_visibility_utils.</code><code class="sig-name descname">clip_point_cloud_to_visible_region</code><span class="sig-paren">(</span><em class="sig-param">egovehicle_pts</em>, <em class="sig-param">lidar_pts</em>, <em class="sig-param">n_polar_bins=100</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/city_visibility_utils.html#clip_point_cloud_to_visible_region"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.city_visibility_utils.clip_point_cloud_to_visible_region" title="Permalink to this definition">¶</a></dt>
<dd><p>LiDAR points provide visibility information for a map point cloud in city coordinates.
We bin the world into polar bins, and then if you’ve gone past the farthest LiDAR point
in that orientation bin, we ignore such city points. Those city points could be lane
centerlines or ROI boundary.</p>
<p>Other options would be to fix a skinny rectangle around the egovehicle (long along road,
and skinny along sidewalks), or to combine cells with &lt;1.41 distance to each other into
a polygon, growing the region with DBSCAN. Could also vectorize this.</p>
<p>We loop through 2 pi radians in n polar bins to find the closest lidar return.
Arctan has range [-pi, pi], so we start our loop there.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>egovehicle_pts</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – 3d points in city coordinate fram</p></li>
<li><p><strong>lidar_pts</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of LiDAR returns</p></li>
<li><p><strong>n_polar_bins</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – number of bins to discretize the unit circle with</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>egovehicle_pts</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.city_visibility_utils.viz_polar_bin_contents">
<code class="sig-prename descclassname">argoverse.utils.city_visibility_utils.</code><code class="sig-name descname">viz_polar_bin_contents</code><span class="sig-paren">(</span><em class="sig-param">bin_lidar_pts</em>, <em class="sig-param">invalid_egovehicle_pts</em>, <em class="sig-param">filename</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/city_visibility_utils.html#viz_polar_bin_contents"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.city_visibility_utils.viz_polar_bin_contents" title="Permalink to this definition">¶</a></dt>
<dd><p>Visualize what the utility is doing within each polar bin.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>bin_lidar_pts</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – array</p></li>
<li><p><strong>invalid_egovehicle_pts</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – array</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.cuboid_interior">
<span id="argoverse-utils-cuboid-interior-module"></span><h2>argoverse.utils.cuboid_interior module<a class="headerlink" href="#module-argoverse.utils.cuboid_interior" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="argoverse.utils.cuboid_interior.extract_pc_in_box3d_hull">
<code class="sig-prename descclassname">argoverse.utils.cuboid_interior.</code><code class="sig-name descname">extract_pc_in_box3d_hull</code><span class="sig-paren">(</span><em class="sig-param">pc</em>, <em class="sig-param">bbox_3d</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/cuboid_interior.html#extract_pc_in_box3d_hull"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.cuboid_interior.extract_pc_in_box3d_hull" title="Permalink to this definition">¶</a></dt>
<dd><p>Find points that fall within a 3d cuboid, by treating the 3d cuboid as a hull.
Scipy.spatial’s Delaunay class performs tesselation in N dimensions. By finding
the simplices containing the given points, we also can determine which points
lie outside the triangulation. Such invalid points obtain the value “-1”. We
threshold these to find the points that fall within the cuboid/hull.</p>
<p>Please see Apache 2.0 license below, which governs this specific function.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>pc</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (N,3) representing point cloud</p></li>
<li><p><strong>bbox_3d</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (8,3) representing 3D cuboid vertices</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>Numpy array of shape (K,3) representing 3d points that fell</dt><dd><p>within 3d cuboid volume.</p>
</dd>
<dt>box3d_roi_inds: Numpy array of shape (N,) of type bool, representing</dt><dd><p>point cloud indices corresponding to points that fall within the
3D cuboid.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>segment</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.cuboid_interior.filter_point_cloud_to_bbox">
<code class="sig-prename descclassname">argoverse.utils.cuboid_interior.</code><code class="sig-name descname">filter_point_cloud_to_bbox</code><span class="sig-paren">(</span><em class="sig-param">bbox</em>, <em class="sig-param">velodyne_pts</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/cuboid_interior.html#filter_point_cloud_to_bbox"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.cuboid_interior.filter_point_cloud_to_bbox" title="Permalink to this definition">¶</a></dt>
<dd><p>Given 2 orthogonal directions “u”, “v” defined by 3 bbox vertices, s.t.:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">u</span> <span class="o">=</span> <span class="n">P1</span> <span class="o">-</span> <span class="n">P2</span>
<span class="n">v</span> <span class="o">=</span> <span class="n">P1</span> <span class="o">-</span> <span class="n">P4</span>
</pre></div>
</div>
<p>a point “x” in R^3 lies within the bbox iff:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;</span><span class="n">u</span><span class="p">,</span><span class="n">P1</span><span class="o">&gt;</span> <span class="o">&gt;=</span> <span class="o">&lt;</span><span class="n">u</span><span class="p">,</span><span class="n">x</span><span class="o">&gt;</span> <span class="o">&gt;=</span> <span class="o">&lt;</span><span class="n">u</span><span class="p">,</span><span class="n">P2</span><span class="o">&gt;</span>
<span class="o">&lt;</span><span class="n">v</span><span class="p">,</span><span class="n">P1</span><span class="o">&gt;</span> <span class="o">&gt;=</span> <span class="o">&lt;</span><span class="n">v</span><span class="p">,</span><span class="n">x</span><span class="o">&gt;</span> <span class="o">&gt;=</span> <span class="o">&lt;</span><span class="n">v</span><span class="p">,</span><span class="n">P4</span><span class="o">&gt;</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>bbox</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (4,3) representing 3D bbox</p></li>
<li><p><strong>velodyne_pts</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – NumPy array of shape (N,3) representing Velodyne point cloud</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>Numpy array of shape (N,3) representing velodyne points</dt><dd><p>that fall inside the cuboid</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>interior_pts</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.cuboid_interior.filter_point_cloud_to_bbox_2D_vectorized">
<code class="sig-prename descclassname">argoverse.utils.cuboid_interior.</code><code class="sig-name descname">filter_point_cloud_to_bbox_2D_vectorized</code><span class="sig-paren">(</span><em class="sig-param">bbox</em>, <em class="sig-param">pc_raw</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/cuboid_interior.html#filter_point_cloud_to_bbox_2D_vectorized"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.cuboid_interior.filter_point_cloud_to_bbox_2D_vectorized" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>bbox</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – NumPy array of shape (4,2) representing 2D bbox</p></li>
<li><p><strong>pc_raw</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – NumPy array of shape (N,3) representing Velodyne point cloud</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>NumPy array of shape (N,3) representing velodyne points</dt><dd><p>that fall inside the cuboid</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>pc_seg</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.cuboid_interior.filter_point_cloud_to_bbox_3D">
<code class="sig-prename descclassname">argoverse.utils.cuboid_interior.</code><code class="sig-name descname">filter_point_cloud_to_bbox_3D</code><span class="sig-paren">(</span><em class="sig-param">bbox</em>, <em class="sig-param">pc_raw</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/cuboid_interior.html#filter_point_cloud_to_bbox_3D"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.cuboid_interior.filter_point_cloud_to_bbox_3D" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>has shape object array</strong> (<em>bbox</em>) – [(3,), (3,), (3,), height]</p></li>
<li><p><strong>pc_raw</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – </p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a></p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.cuboid_interior.filter_point_cloud_to_bbox_3D_single_pt">
<code class="sig-prename descclassname">argoverse.utils.cuboid_interior.</code><code class="sig-name descname">filter_point_cloud_to_bbox_3D_single_pt</code><span class="sig-paren">(</span><em class="sig-param">bbox</em>, <em class="sig-param">x</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/cuboid_interior.html#filter_point_cloud_to_bbox_3D_single_pt"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.cuboid_interior.filter_point_cloud_to_bbox_3D_single_pt" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>bbox</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (8,1)</p></li>
<li><p><strong>x</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (3,1)</p></li>
</ul>
</dd>
</dl>
<p><a class="reference external" href="https://math.stackexchange.com/questions/1472049/check-if-a-point-is-inside-a-rectangular-shaped-area-3d">https://math.stackexchange.com/questions/1472049/check-if-a-point-is-inside-a-rectangular-shaped-area-3d</a></p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>    <span class="mi">5</span><span class="o">------</span><span class="mi">4</span>
    <span class="o">|</span>\\    <span class="o">|</span>\\
    <span class="o">|</span> \\   <span class="o">|</span> \\
    <span class="mi">6</span><span class="o">--</span>\\<span class="o">--</span><span class="mi">7</span>  \\
    \\  \\  \\ \\
<span class="n">l</span>    \\  <span class="mi">1</span><span class="o">-------</span><span class="mi">0</span>    <span class="n">h</span>
 <span class="n">e</span>    \\ <span class="o">||</span>   \\ <span class="o">||</span>   <span class="n">e</span>
  <span class="n">n</span>    \\<span class="o">||</span>    \\<span class="o">||</span>   <span class="n">i</span>
   <span class="n">g</span>    \\<span class="mi">2</span><span class="o">------</span><span class="mi">3</span>    <span class="n">g</span>
    <span class="n">t</span>      <span class="n">width</span><span class="o">.</span>     <span class="n">h</span>
     <span class="n">h</span><span class="o">.</span>               <span class="n">t</span><span class="o">.</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a></p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.cuboid_interior.filter_point_cloud_to_bbox_3D_vectorized">
<code class="sig-prename descclassname">argoverse.utils.cuboid_interior.</code><code class="sig-name descname">filter_point_cloud_to_bbox_3D_vectorized</code><span class="sig-paren">(</span><em class="sig-param">bbox</em>, <em class="sig-param">pc_raw</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/cuboid_interior.html#filter_point_cloud_to_bbox_3D_vectorized"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.cuboid_interior.filter_point_cloud_to_bbox_3D_vectorized" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>bbox</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array pf shape (8,3) representing 3d cuboid vertices, ordered
as shown below.</p></li>
<li><p><strong>pc_raw</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (N,3), representing a point cloud</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>Numpy array of shape (K,3) representing 3d points that fell</dt><dd><p>within 3d cuboid volume.</p>
</dd>
</dl>
<p>is_valid: Numpy array of shape (N,) of type bool</p>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>segment</p>
</dd>
</dl>
<p><a class="reference external" href="https://math.stackexchange.com/questions/1472049/check-if-a-point-is-inside-a-rectangular-shaped-area-3d">https://math.stackexchange.com/questions/1472049/check-if-a-point-is-inside-a-rectangular-shaped-area-3d</a></p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>    <span class="mi">5</span><span class="o">------</span><span class="mi">4</span>
    <span class="o">|</span>\\    <span class="o">|</span>\\
    <span class="o">|</span> \\   <span class="o">|</span> \\
    <span class="mi">6</span><span class="o">--</span>\\<span class="o">--</span><span class="mi">7</span>  \\
    \\  \\  \\ \\
<span class="n">l</span>    \\  <span class="mi">1</span><span class="o">-------</span><span class="mi">0</span>    <span class="n">h</span>
 <span class="n">e</span>    \\ <span class="o">||</span>   \\ <span class="o">||</span>   <span class="n">e</span>
  <span class="n">n</span>    \\<span class="o">||</span>    \\<span class="o">||</span>   <span class="n">i</span>
   <span class="n">g</span>    \\<span class="mi">2</span><span class="o">------</span><span class="mi">3</span>    <span class="n">g</span>
    <span class="n">t</span>      <span class="n">width</span><span class="o">.</span>     <span class="n">h</span>
     <span class="n">h</span><span class="o">.</span>               <span class="n">t</span><span class="o">.</span>
</pre></div>
</div>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.cuboid_interior.in_between_matrix">
<code class="sig-prename descclassname">argoverse.utils.cuboid_interior.</code><code class="sig-name descname">in_between_matrix</code><span class="sig-paren">(</span><em class="sig-param">x</em>, <em class="sig-param">v1</em>, <em class="sig-param">v2</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/cuboid_interior.html#in_between_matrix"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.cuboid_interior.in_between_matrix" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a></p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.cv2_plotting_utils">
<span id="argoverse-utils-cv2-plotting-utils-module"></span><h2>argoverse.utils.cv2_plotting_utils module<a class="headerlink" href="#module-argoverse.utils.cv2_plotting_utils" title="Permalink to this headline">¶</a></h2>
<p>OpenCV plotting utility functions.</p>
<dl class="function">
<dt id="argoverse.utils.cv2_plotting_utils.draw_clipped_line_segment">
<code class="sig-prename descclassname">argoverse.utils.cv2_plotting_utils.</code><code class="sig-name descname">draw_clipped_line_segment</code><span class="sig-paren">(</span><em class="sig-param">img</em>, <em class="sig-param">vert_a</em>, <em class="sig-param">vert_b</em>, <em class="sig-param">camera_config</em>, <em class="sig-param">linewidth</em>, <em class="sig-param">planes</em>, <em class="sig-param">color</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/cv2_plotting_utils.html#draw_clipped_line_segment"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.cv2_plotting_utils.draw_clipped_line_segment" title="Permalink to this definition">¶</a></dt>
<dd><p>Plot the portion of a line segment that lives within a parameterized 3D camera frustum.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>img</strong> (<em>&lt;built-in function array&gt;</em>) – Numpy array of shape (M,N,3)</p></li>
<li><p><strong>vert_a</strong> (<em>&lt;built-in function array&gt;</em>) – first point, in the camera coordinate frame.</p></li>
<li><p><strong>vert_b</strong> (<em>&lt;built-in function array&gt;</em>) – second point, in the camera coordinate frame.</p></li>
<li><p><strong>camera_config</strong> (<a class="reference internal" href="#argoverse.utils.calibration.CameraConfig" title="argoverse.utils.calibration.CameraConfig"><code class="xref py py-class docutils literal notranslate"><span class="pre">CameraConfig</span></code></a>) – CameraConfig object</p></li>
<li><p><strong>linewidth</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – integer, linewidth for plot</p></li>
<li><p><strong>planes</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.List" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">List</span></code></a>[<code class="xref py py-class docutils literal notranslate"><span class="pre">Tuple</span></code>[&lt;built-in function array&gt;, &lt;built-in function array&gt;, &lt;built-in function array&gt;, &lt;built-in function array&gt;, &lt;built-in function array&gt;]]) – frustum clipping plane parameters</p></li>
<li><p><strong>color</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]) – RGB 3-tuple</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.cv2_plotting_utils.draw_point_cloud_in_img_cv2">
<code class="sig-prename descclassname">argoverse.utils.cv2_plotting_utils.</code><code class="sig-name descname">draw_point_cloud_in_img_cv2</code><span class="sig-paren">(</span><em class="sig-param">img</em>, <em class="sig-param">xy</em>, <em class="sig-param">colors</em>, <em class="sig-param">radius=5</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/cv2_plotting_utils.html#draw_point_cloud_in_img_cv2"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.cv2_plotting_utils.draw_point_cloud_in_img_cv2" title="Permalink to this definition">¶</a></dt>
<dd><p>Plot a point cloud in an image by drawing small circles centered at (x,y) locations.</p>
<p>Note these are not (u,v) but rather (v,u) coordinate pairs.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>img</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of shape (M, N, 3), representing an image with channel order BGR, per the OpenCV convention</p></li>
<li><p><strong>xy</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of shape (K, 2) representing the center coordinates of each circle</p></li>
<li><p><strong>colors</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of shape (K, 3), with BGR values in [0, 255] representing the fill color for each circle</p></li>
<li><p><strong>radius</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – radius of all circles</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Array of shape (M, N, 3), with all circles plotted</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>img</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.cv2_plotting_utils.draw_polygon_cv2">
<code class="sig-prename descclassname">argoverse.utils.cv2_plotting_utils.</code><code class="sig-name descname">draw_polygon_cv2</code><span class="sig-paren">(</span><em class="sig-param">points</em>, <em class="sig-param">image</em>, <em class="sig-param">color</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/cv2_plotting_utils.html#draw_polygon_cv2"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.cv2_plotting_utils.draw_polygon_cv2" title="Permalink to this definition">¶</a></dt>
<dd><p>Draw a polygon onto an image using the given points and fill color.</p>
<p>These polygons are often non-convex, so we cannot use cv2.fillConvexPoly().
Note that cv2.fillPoly() accepts an array of array of points as an
argument (i.e. an array of polygons where each polygon is represented
as an array of points).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>points</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of shape (N, 2) representing all points of the polygon</p></li>
<li><p><strong>image</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of shape (M, N, 3) representing the image to be drawn onto</p></li>
<li><p><strong>color</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]) – Tuple of shape (3,) with a BGR format color</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Array of shape (M, N, 3) with polygon rendered on it</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>image</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.cv2_plotting_utils.draw_polyline_cv2">
<code class="sig-prename descclassname">argoverse.utils.cv2_plotting_utils.</code><code class="sig-name descname">draw_polyline_cv2</code><span class="sig-paren">(</span><em class="sig-param">line_segments_arr</em>, <em class="sig-param">image</em>, <em class="sig-param">color</em>, <em class="sig-param">im_h</em>, <em class="sig-param">im_w</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/cv2_plotting_utils.html#draw_polyline_cv2"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.cv2_plotting_utils.draw_polyline_cv2" title="Permalink to this definition">¶</a></dt>
<dd><p>Draw a polyline onto an image using given line segments.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>line_segments_arr</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of shape (K, 2) representing the coordinates of each line segment</p></li>
<li><p><strong>image</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of shape (M, N, 3), representing a 3-channel BGR image</p></li>
<li><p><strong>color</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]) – Tuple of shape (3,) with a BGR format color</p></li>
<li><p><strong>im_h</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – Image height in pixels</p></li>
<li><p><strong>im_w</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – Image width in pixels</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.cv2_plotting_utils.get_img_contours">
<code class="sig-prename descclassname">argoverse.utils.cv2_plotting_utils.</code><code class="sig-name descname">get_img_contours</code><span class="sig-paren">(</span><em class="sig-param">img</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/cv2_plotting_utils.html#get_img_contours"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.cv2_plotting_utils.get_img_contours" title="Permalink to this definition">¶</a></dt>
<dd><p>Uses</p>
<p>Ref: Suzuki, S. and Abe, K., Topological Structural Analysis of Digitized Binary Images
by Border Following. CVGIP 30 1, pp 32-46 (1985)</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>img</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – binary image with zero and one values</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Numpy array</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>contours</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.cv2_plotting_utils.plot_bbox_polygon_cv2">
<code class="sig-prename descclassname">argoverse.utils.cv2_plotting_utils.</code><code class="sig-name descname">plot_bbox_polygon_cv2</code><span class="sig-paren">(</span><em class="sig-param">img</em>, <em class="sig-param">track_id</em>, <em class="sig-param">color</em>, <em class="sig-param">bbox</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/cv2_plotting_utils.html#plot_bbox_polygon_cv2"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.cv2_plotting_utils.plot_bbox_polygon_cv2" title="Permalink to this definition">¶</a></dt>
<dd><p>Draw a colored bounding box with a red border.</p>
<p>We use OpenCV’s rectangle rendering to draw the thin red border.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>img</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of shape (M,N,3) represnenting the image to plot the bounding box onto</p></li>
<li><p><strong>track_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The track id to use as a label</p></li>
<li><p><strong>color</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy Array of shape (3,) with a BGR format color</p></li>
<li><p><strong>bbox</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array, containing values xmin, ymin, xmax, ymax. Note that the requested color is placed in
xmax-1 and ymax-1, but not beyond. in accordance with Numpy indexing implementation).
All values on the border (touching xmin, or xmax, or ymin, or ymax along an edge) will be colored red.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Array of shape (M, N, 3)</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>img</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.datetime_utils">
<span id="argoverse-utils-datetime-utils-module"></span><h2>argoverse.utils.datetime_utils module<a class="headerlink" href="#module-argoverse.utils.datetime_utils" title="Permalink to this headline">¶</a></h2>
<p>Datetime utility functions.</p>
<dl class="function">
<dt id="argoverse.utils.datetime_utils.generate_datetime_string">
<code class="sig-prename descclassname">argoverse.utils.datetime_utils.</code><code class="sig-name descname">generate_datetime_string</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/datetime_utils.html#generate_datetime_string"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.datetime_utils.generate_datetime_string" title="Permalink to this definition">¶</a></dt>
<dd><p>Generate a formatted datetime string.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a></p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>String with of the format YYYY_MM_DD_HH_MM_SS with 24-hour time used</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.dilation_utils">
<span id="argoverse-utils-dilation-utils-module"></span><h2>argoverse.utils.dilation_utils module<a class="headerlink" href="#module-argoverse.utils.dilation_utils" title="Permalink to this headline">¶</a></h2>
<p>Utility functions for dilation.</p>
<dl class="function">
<dt id="argoverse.utils.dilation_utils.dilate_by_l2">
<code class="sig-prename descclassname">argoverse.utils.dilation_utils.</code><code class="sig-name descname">dilate_by_l2</code><span class="sig-paren">(</span><em class="sig-param">img</em>, <em class="sig-param">dilation_thresh=5.0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/dilation_utils.html#dilate_by_l2"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.dilation_utils.dilate_by_l2" title="Permalink to this definition">¶</a></dt>
<dd><p>Dilate a mask using the L2 distance from a zero pixel.</p>
<p>OpenCV’s distance transform calculates the DISTANCE TO THE CLOSEST ZERO PIXEL for each
pixel of the source image. Although the distance type could be L1, L2, etc, we use L2.</p>
<p>We specify the “maskSize”, which represents the size of the distance transform mask. It can
be 3, 5, or CV_DIST_MASK_PRECISE (the latter option is only supported by the first function).</p>
<p>For us, foreground values are 1 and background values are 0.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>img</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of shape (M, N) representing an 8-bit single-channel (binary) source image</p></li>
<li><p><strong>dilation_thresh</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) – Threshold for how far away a zero pixel can be</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>An image with the same size with the dilated mask</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.ffmpeg_utils">
<span id="argoverse-utils-ffmpeg-utils-module"></span><h2>argoverse.utils.ffmpeg_utils module<a class="headerlink" href="#module-argoverse.utils.ffmpeg_utils" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="argoverse.utils.ffmpeg_utils.write_nonsequential_idx_video">
<code class="sig-prename descclassname">argoverse.utils.ffmpeg_utils.</code><code class="sig-name descname">write_nonsequential_idx_video</code><span class="sig-paren">(</span><em class="sig-param">img_wildcard</em>, <em class="sig-param">output_fpath</em>, <em class="sig-param">fps</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/ffmpeg_utils.html#write_nonsequential_idx_video"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.ffmpeg_utils.write_nonsequential_idx_video" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>img_wildcard</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – string</p></li>
<li><p><strong>output_fpath</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – string</p></li>
<li><p><strong>fps</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – integer, frames per second</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>None</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.ffmpeg_utils.write_video">
<code class="sig-prename descclassname">argoverse.utils.ffmpeg_utils.</code><code class="sig-name descname">write_video</code><span class="sig-paren">(</span><em class="sig-param">image_prefix</em>, <em class="sig-param">output_prefix</em>, <em class="sig-param">fps=10</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/ffmpeg_utils.html#write_video"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.ffmpeg_utils.write_video" title="Permalink to this definition">¶</a></dt>
<dd><p>Use FFMPEG to write a video to disk, from a sequence of images.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>image_prefix</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – string, with %d embedded inside and ending with
a prefix, e.g. .png/.jpg. Absolute path</p></li>
<li><p><strong>output_prefix</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – absolute path for output video, without .mp4 prefix</p></li>
<li><p><strong>fps</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – integer, frames per second</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>None</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.forecasting_evaluation">
<span id="argoverse-utils-forecasting-evaluation-module"></span><h2>argoverse.utils.forecasting_evaluation module<a class="headerlink" href="#module-argoverse.utils.forecasting_evaluation" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="argoverse.utils.forecasting_evaluation.compute_summed_distance_point_cloud2D">
<code class="sig-prename descclassname">argoverse.utils.forecasting_evaluation.</code><code class="sig-name descname">compute_summed_distance_point_cloud2D</code><span class="sig-paren">(</span><em class="sig-param">points_a</em>, <em class="sig-param">points_b</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/forecasting_evaluation.html#compute_summed_distance_point_cloud2D"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.forecasting_evaluation.compute_summed_distance_point_cloud2D" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>points_a</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – numpy n-d array with dims (N x 2)</p></li>
<li><p><strong>points_b</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – numpy n-d array with dims (N x 2)</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>summed L2 norm between each pair of corresponding 2D points</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>scalar (double)</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.forecasting_evaluation.evaluate_prediction">
<code class="sig-prename descclassname">argoverse.utils.forecasting_evaluation.</code><code class="sig-name descname">evaluate_prediction</code><span class="sig-paren">(</span><em class="sig-param">pred_traj</em>, <em class="sig-param">ground_truth_traj</em>, <em class="sig-param">eval_method='EVAL_DESTINATION_ONLY'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/forecasting_evaluation.html#evaluate_prediction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.forecasting_evaluation.evaluate_prediction" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute the error as L2 norm in trajectories</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>pred_traj</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – numpy n-d array with dims (N x 2)</p></li>
<li><p><strong>ground_truth_traj</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – numpy n-d array with dims (N x 2)</p></li>
<li><p><strong>eval_method</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – </p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a></p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.frustum_clipping">
<span id="argoverse-utils-frustum-clipping-module"></span><h2>argoverse.utils.frustum_clipping module<a class="headerlink" href="#module-argoverse.utils.frustum_clipping" title="Permalink to this headline">¶</a></h2>
<p>Collection of utilities to explicitly form the camera view frustum and clip line segments to within frustum view.</p>
<p>These utilities use focal lengths and camera image dimensions to create camera view frustums,
and then to clip line segments to live within the frustum only.</p>
<dl class="function">
<dt id="argoverse.utils.frustum_clipping.clip_segment_v3_plane_n">
<code class="sig-prename descclassname">argoverse.utils.frustum_clipping.</code><code class="sig-name descname">clip_segment_v3_plane_n</code><span class="sig-paren">(</span><em class="sig-param">p1</em>, <em class="sig-param">p2</em>, <em class="sig-param">planes</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/frustum_clipping.html#clip_segment_v3_plane_n"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.frustum_clipping.clip_segment_v3_plane_n" title="Permalink to this definition">¶</a></dt>
<dd><p>Iterate over the frustum planes and intersect them with the segment.</p>
<p>This  updating the min/max, bailing out early if the min &gt; max.
We exploit the fact that in a camera frustum, all plane
normals point inside the frustum volume.</p>
<p>See section “Line-Plane Intersection” for technical details at: <a class="reference external" href="http://geomalgorithms.com/a05-_intersect-1.html">http://geomalgorithms.com/a05-_intersect-1.html</a></p>
<p>“t” is the distance we travel along the ray from p1 to p2.
If “t” exceeds 1.0, then we have exceeded the line segment.</p>
<p>A similar function, written in C, can be found in the Blender source code at:
<a class="reference external" href="https://fossies.org/dox/blender-2.79b/math__geom_8c_source.html">https://fossies.org/dox/blender-2.79b/math__geom_8c_source.html</a></p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>p1</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – 3D vector defining a point to constrain a line segment</p></li>
<li><p><strong>p2</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – 3D vector defining a point to constrain a line segment</p></li>
<li><p><strong>planes</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.List" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">List</span></code></a>[<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>]) – List of length 5, where each list element is an Array of shape (4,)
representing the equation of a plane, e.g. (a, b, c, d) in ax + by + cz = d</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>, <a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>]</p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>2 vector triplets (the clipped segment) or (None, None) meaning the segment is entirely outside the frustum.</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.frustum_clipping.cuboid_to_2d_frustum_bbox">
<code class="sig-prename descclassname">argoverse.utils.frustum_clipping.</code><code class="sig-name descname">cuboid_to_2d_frustum_bbox</code><span class="sig-paren">(</span><em class="sig-param">corners</em>, <em class="sig-param">planes</em>, <em class="sig-param">K</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/frustum_clipping.html#cuboid_to_2d_frustum_bbox"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.frustum_clipping.cuboid_to_2d_frustum_bbox" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert a 3D cuboid to a 2D frustum bounding box.</p>
<p>We bring the 3D points into each camera, and do the clipping there.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>corners</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – The corners to use as the corners of the frustum bounding box</p></li>
<li><p><strong>planes</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.List" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">List</span></code></a>[<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>]) – List of 4-tuples for ax + by + cz = d representing planes in Hessian Normal Form</p></li>
<li><p><strong>K</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – 3x3 camera intrinsic matrix</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Numpy array of shape (4,) with entries [x_min,y_min,x_max,y_max]</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>bbox_2d</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.frustum_clipping.fit_plane_to_point_cloud">
<code class="sig-prename descclassname">argoverse.utils.frustum_clipping.</code><code class="sig-name descname">fit_plane_to_point_cloud</code><span class="sig-paren">(</span><em class="sig-param">pc</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/frustum_clipping.html#fit_plane_to_point_cloud"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.frustum_clipping.fit_plane_to_point_cloud" title="Permalink to this definition">¶</a></dt>
<dd><p>Use SVD with at least 3 points to fit a plane.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>pc</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of shape (N, 3)</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>float-like values defining ax + by + cz = d for the plane</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>a, b, c, d</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.frustum_clipping.form_left_clipping_plane">
<code class="sig-prename descclassname">argoverse.utils.frustum_clipping.</code><code class="sig-name descname">form_left_clipping_plane</code><span class="sig-paren">(</span><em class="sig-param">fx</em>, <em class="sig-param">img_width</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/frustum_clipping.html#form_left_clipping_plane"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.frustum_clipping.form_left_clipping_plane" title="Permalink to this definition">¶</a></dt>
<dd><p>Form the left clipping plane for a camera view frustum.</p>
<p>In the camera coordinate frame, y is down the imager, x is across the imager,
and z is along the optical axis. The focal length is the distance to the center
of the image plane. We know that a similar triangle is formed as follows:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>                  <span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">z</span><span class="p">)</span><span class="o">-----</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">z</span><span class="p">)</span>
                     \\          <span class="o">|</span>
<span class="n">outside</span> <span class="n">of</span> <span class="n">frustum</span> <span class="o">&lt;-</span> \\         <span class="o">|</span>
 <span class="n">outside</span> <span class="n">of</span> <span class="n">frustum</span> <span class="o">&lt;-</span> \\        <span class="o">|</span>
                        \\ <span class="p">(</span><span class="o">-</span><span class="n">w</span><span class="o">/</span><span class="mi">2</span><span class="p">)</span><span class="o">|</span>
                          <span class="n">o</span><span class="o">------</span><span class="n">o</span> <span class="n">IMAGE</span> <span class="n">PLANE</span>
                          \\     <span class="o">|</span>
                           \\    <span class="o">|</span>
                            \\   <span class="o">|</span><span class="n">fx</span>
                             \\  <span class="o">|</span>
                              \\ <span class="o">|</span>
                                 <span class="n">O</span> <span class="n">PINHOLE</span>
</pre></div>
</div>
<p>Normal must point into the frustum. The plane moves +fx in z-axis for
every -w/2 in x-axis, so normal will have negative inverse slope components.
The “d” in “ax + by + cz = d” is zero because plane goes through origin.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>fx</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) – Horizontal focal length in pixels</p></li>
<li><p><strong>img_width</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – Image width in pixels</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Array of shape (4,) for ax + by + cz = d</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>left_plane</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.frustum_clipping.form_low_clipping_plane">
<code class="sig-prename descclassname">argoverse.utils.frustum_clipping.</code><code class="sig-name descname">form_low_clipping_plane</code><span class="sig-paren">(</span><em class="sig-param">fx</em>, <em class="sig-param">img_height</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/frustum_clipping.html#form_low_clipping_plane"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.frustum_clipping.form_low_clipping_plane" title="Permalink to this definition">¶</a></dt>
<dd><p>Form the low clipping plane for a camera view frustum.</p>
<p>Use 3 points to fit the low clipping plane. In the camera coordinate frame,
y is down the imager, x is across the imager, and z is along the optical axis.
We know that a similar triangle is formed as follows:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>        <span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">z</span><span class="p">)</span>              <span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">z</span><span class="p">)</span>
           \\                   <span class="o">//</span>
            \\ <span class="n">o</span><span class="o">-------------</span><span class="n">o</span> <span class="o">//</span>
             \\<span class="o">|</span> <span class="n">IMAGE</span> <span class="n">PLANE</span> <span class="o">|//</span>
               <span class="o">|</span>             <span class="o">|/</span>
<span class="p">(</span><span class="o">-</span><span class="n">w</span><span class="o">/</span><span class="n">h</span><span class="p">,</span> <span class="n">h</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span><span class="n">fx</span><span class="p">)</span> <span class="n">o</span><span class="o">-------------</span><span class="n">o</span> <span class="p">(</span><span class="n">w</span><span class="o">/</span><span class="n">h</span><span class="p">,</span> <span class="n">h</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span><span class="n">fx</span><span class="p">)</span>
                \\         <span class="o">//</span>
                 \\       <span class="o">//</span>
                  \\     <span class="o">//</span>
                   \\   <span class="o">//</span>
                    \\ <span class="o">//</span>
                      <span class="n">O</span> <span class="n">PINHOLE</span>
</pre></div>
</div>
<p>Normal must point into the frustum. The plane moves +h/2 in y-axis for every
+fx in z-axis, so normal will have negative inverse slope components. The
x-axis component is zero since constant in x.</p>
<p>Then enforce that y-coord of normal points in neg y-axis dir(up) on low-clipping plane.
The z-coord should point in positive z-axis direction (away from camera).
The “d” in “ax + by + cz = d” is zero because plane goes through origin.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>fx</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) – Horizontal focal length in pixels</p></li>
<li><p><strong>img_height</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – Image height in pixels</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Array of shape (4,) for ax + by + cz = d</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>low_plane</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.frustum_clipping.form_near_clipping_plane">
<code class="sig-prename descclassname">argoverse.utils.frustum_clipping.</code><code class="sig-name descname">form_near_clipping_plane</code><span class="sig-paren">(</span><em class="sig-param">near_clip_dist</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/frustum_clipping.html#form_near_clipping_plane"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.frustum_clipping.form_near_clipping_plane" title="Permalink to this definition">¶</a></dt>
<dd><p>Form the near clipping plane for a camera view frustum.</p>
<p>In the camera coordinate frame, y is down the imager, x is across the imager,
and z is along the optical axis. The near clipping plane should point in
the positive z-direction (along optical axis).</p>
<p>We form “ax + by + cz = d”, where “d” is a distance from the origin.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>near_clip_dist</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) – Near clipping plane distance in meters</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Array of shape (4,) for ax + by + cz = d</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>top_plane</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.frustum_clipping.form_right_clipping_plane">
<code class="sig-prename descclassname">argoverse.utils.frustum_clipping.</code><code class="sig-name descname">form_right_clipping_plane</code><span class="sig-paren">(</span><em class="sig-param">fx</em>, <em class="sig-param">img_width</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/frustum_clipping.html#form_right_clipping_plane"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.frustum_clipping.form_right_clipping_plane" title="Permalink to this definition">¶</a></dt>
<dd><p>Form the right clipping plane for a camera view frustum.</p>
<p>In the camera coordinate frame, y is down the imager, x is across the imager,
and z is along the optical axis. The focal length is the distance to the center
of the image plane. We know that a similar triangle is formed as follows:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">z</span><span class="p">)</span><span class="o">--</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">z</span><span class="p">)</span>
  <span class="o">|</span>         <span class="o">/</span>
  <span class="o">|</span>        <span class="o">/</span> <span class="o">-&gt;</span><span class="n">outside</span> <span class="n">of</span> <span class="n">frustum</span>
  <span class="o">|</span>       <span class="o">/</span> <span class="o">-&gt;</span><span class="n">outside</span> <span class="n">of</span> <span class="n">frustum</span>
  <span class="o">|</span> <span class="p">(</span><span class="n">w</span><span class="o">/</span><span class="mi">2</span><span class="p">)</span><span class="o">/</span>
  <span class="n">o</span><span class="o">-----</span><span class="n">o</span> <span class="n">IMAGE</span> <span class="n">PLANE</span>
  <span class="o">|</span>    <span class="o">/</span>
<span class="n">fx</span><span class="o">|</span>   <span class="o">/</span>
  <span class="o">|</span>  <span class="o">/</span>
  <span class="o">|</span> <span class="o">/</span>
  <span class="n">O</span> <span class="n">PINHOLE</span>
</pre></div>
</div>
<p>Normal must point into the frustum. The plane moves +fx in z-axis for
every +w/2 in x-axis, so normal will have negative inverse slope components.</p>
<p>Then, enforce that x-component of normal points in negative direction.
The “d” in “ax + by + cz = d” is zero because plane goes through origin.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>fx</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) – Horizontal focal length in pixels</p></li>
<li><p><strong>img_width</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – Image width in pixels</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Array of shape (4,) for ax + by + cz = d</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>right_plane</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.frustum_clipping.form_top_clipping_plane">
<code class="sig-prename descclassname">argoverse.utils.frustum_clipping.</code><code class="sig-name descname">form_top_clipping_plane</code><span class="sig-paren">(</span><em class="sig-param">fx</em>, <em class="sig-param">img_height</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/frustum_clipping.html#form_top_clipping_plane"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.frustum_clipping.form_top_clipping_plane" title="Permalink to this definition">¶</a></dt>
<dd><p>Form the top clipping plane for a camera view frustum.</p>
<p>In the camera coordinate frame, y is down the imager, x is across the imager,
and z is along the optical axis. The focal length is the distance to the center
of the image plane. We know that a similar triangle is formed as follows:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>  <span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">z</span><span class="p">)</span>               <span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">z</span><span class="p">)</span>
      \\<span class="o">=================//</span>
       \\               <span class="o">//</span>
<span class="p">(</span><span class="o">-</span><span class="n">w</span><span class="o">/</span><span class="n">h</span><span class="p">,</span><span class="o">-</span><span class="n">h</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span><span class="n">fx</span><span class="p">)</span>       <span class="p">(</span><span class="n">w</span><span class="o">/</span><span class="n">h</span><span class="p">,</span><span class="o">-</span><span class="n">h</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span><span class="n">fx</span><span class="p">)</span>
         <span class="n">o</span><span class="o">-------------</span><span class="n">o</span>
         <span class="o">|</span>\\         <span class="o">//|</span> <span class="n">IMAGE</span> <span class="n">PLANE</span>
         <span class="o">|</span> \\       <span class="o">//</span> <span class="o">|</span> <span class="n">IMAGE</span> <span class="n">PLANE</span>
         <span class="n">o</span><span class="o">--</span>\\<span class="o">-----//--</span><span class="n">o</span>
             \\   <span class="o">//</span>
              \\ <span class="o">//</span>
                <span class="n">O</span> <span class="n">PINHOLE</span>
</pre></div>
</div>
<p>Normal must point into the frustum. The plane moves -h/2 in y-axis for every
+fx in z-axis, so normal will have negative inverse slope components. The
x-axis component is zero since constant in x.
The “d” in “ax + by + cz = d” is zero because plane goes through origin.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>fx</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) – Horizontal focal length in pixels</p></li>
<li><p><strong>img_height</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – Image height in pixels</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Array of shape (4,) for ax + by + cz = d</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>top_plane</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.frustum_clipping.generate_frustum_planes">
<code class="sig-prename descclassname">argoverse.utils.frustum_clipping.</code><code class="sig-name descname">generate_frustum_planes</code><span class="sig-paren">(</span><em class="sig-param">K</em>, <em class="sig-param">camera_name</em>, <em class="sig-param">near_clip_dist=0.5</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/frustum_clipping.html#generate_frustum_planes"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.frustum_clipping.generate_frustum_planes" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute the planes enclosing the field of view (viewing frustum) for a single camera.</p>
<p>We do this using similar triangles.
tan(theta/2) = (0.5 * height)/focal_length
“theta” is the vertical FOV. Similar for horizontal FOV.
height and focal_length are both in pixels.</p>
<p>Note that ring cameras and stereo cameras have different image widths
and heights, affecting the field of view.</p>
<p>Ring Camera intrinsics K look like (in pixels):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="mi">1400</span><span class="p">,</span>   <span class="mi">0</span><span class="p">,</span> <span class="mi">964</span><span class="p">]</span>     <span class="p">[</span><span class="n">fx</span><span class="p">,</span><span class="n">skew</span><span class="p">,</span><span class="n">cx</span><span class="p">]</span>
<span class="p">[</span>   <span class="mi">0</span><span class="p">,</span><span class="mi">1403</span><span class="p">,</span> <span class="mi">605</span><span class="p">]</span> <span class="k">for</span> <span class="p">[</span><span class="o">-</span><span class="p">,</span>   <span class="n">fy</span><span class="p">,</span><span class="n">cy</span><span class="p">]</span>
<span class="p">[</span>   <span class="mi">0</span><span class="p">,</span>   <span class="mi">0</span><span class="p">,</span>   <span class="mi">1</span><span class="p">]</span>     <span class="p">[</span><span class="mi">0</span><span class="p">,</span>    <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">]</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>K</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of shape (3, 3) representing camera intrinsics matrix</p></li>
<li><p><strong>camera_name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – String representing the camera name to get the dimensions of and compute the FOV for</p></li>
<li><p><strong>near_clip_dist</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) – The distance for the near clipping plane in meters</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>List of length 5, where each list element is an Array of shape (4,)</dt><dd><p>representing the equation of a plane, e.g. (a, b, c, d) in ax + by + cz = d</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>planes</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.frustum_clipping.plane_point_side_v3">
<code class="sig-prename descclassname">argoverse.utils.frustum_clipping.</code><code class="sig-name descname">plane_point_side_v3</code><span class="sig-paren">(</span><em class="sig-param">p</em>, <em class="sig-param">v</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/frustum_clipping.html#plane_point_side_v3"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.frustum_clipping.plane_point_side_v3" title="Permalink to this definition">¶</a></dt>
<dd><p>Get sign of point to plane distance.</p>
<p>This function does not compute the actual distance.</p>
<p>Positive denotes that point v is on the same side of the plane as the plane’s normal vector.
Negative if it is on the opposite side.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>p</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of shape (4,) representing a plane in Hessian Normal Form, ax + by + cz + d = 0</p></li>
<li><p><strong>v</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – A vector/3D point</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A float-like value representing sign of signed distance</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>sign</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.geometry">
<span id="argoverse-utils-geometry-module"></span><h2>argoverse.utils.geometry module<a class="headerlink" href="#module-argoverse.utils.geometry" title="Permalink to this headline">¶</a></h2>
<p>Collection of functions that handle filtering a point cloud to a 2D polygon.</p>
<p>For filtering to 3D polygons, please see cuboid_interior.py or iou_3d.py instead.</p>
<dl class="function">
<dt id="argoverse.utils.geometry.filter_point_cloud_to_polygon">
<code class="sig-prename descclassname">argoverse.utils.geometry.</code><code class="sig-name descname">filter_point_cloud_to_polygon</code><span class="sig-paren">(</span><em class="sig-param">polygon</em>, <em class="sig-param">point_cloud</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/geometry.html#filter_point_cloud_to_polygon"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.geometry.filter_point_cloud_to_polygon" title="Permalink to this definition">¶</a></dt>
<dd><p>Filter a point cloud to the points within a polygon.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>polygon</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of shape (K, 2) representing points of a polygon</p></li>
<li><p><strong>point_cloud</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of shape (N, 2) or (N, 3) representing points in a point cloud</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Array of shape (N, 3) representing filtered points.
Returns None if no point falls within the polygon.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>interior_pts</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.geometry.point_inside_polygon">
<code class="sig-prename descclassname">argoverse.utils.geometry.</code><code class="sig-name descname">point_inside_polygon</code><span class="sig-paren">(</span><em class="sig-param">n_vertices</em>, <em class="sig-param">poly_x_pts</em>, <em class="sig-param">poly_y_pts</em>, <em class="sig-param">test_x</em>, <em class="sig-param">test_y</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/geometry.html#point_inside_polygon"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.geometry.point_inside_polygon" title="Permalink to this definition">¶</a></dt>
<dd><p>Check whether a point is inside a polygon.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>n_vertices</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – number of vertices in the polygon</p></li>
<li><p><strong>Array containing the x-coordinates of the polygon's vertices.</strong> (<em>vert_x_pts</em><em>,</em>) – </p></li>
<li><p><strong>vert_y_pts</strong> – Array containing the y-coordinates of the polygon’s vertices.</p></li>
<li><p><strong>test_y</strong> (<em>test_x</em><em>,</em>) – the x- and y-coordinate of the test point</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>boolean, whether point lies inside polygon</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>inside</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.geometry.rotate_polygon_about_pt">
<code class="sig-prename descclassname">argoverse.utils.geometry.</code><code class="sig-name descname">rotate_polygon_about_pt</code><span class="sig-paren">(</span><em class="sig-param">pts</em>, <em class="sig-param">rotmat</em>, <em class="sig-param">center_pt</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/geometry.html#rotate_polygon_about_pt"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.geometry.rotate_polygon_about_pt" title="Permalink to this definition">¶</a></dt>
<dd><p>Rotate a polygon about a point with a given rotation matrix.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>pts</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of shape (N, 3) representing a polygon or point cloud</p></li>
<li><p><strong>rotmat</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of shape (3, 3) representing a rotation matrix</p></li>
<li><p><strong>center_pt</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of shape (3,) representing point about which we rotate the polygon</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Array of shape (N, 3) representing a ROTATED polygon or point cloud</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>rot_pts</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.grid_interpolation">
<span id="argoverse-utils-grid-interpolation-module"></span><h2>argoverse.utils.grid_interpolation module<a class="headerlink" href="#module-argoverse.utils.grid_interpolation" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="argoverse.utils.grid_interpolation.interp_square_grid">
<code class="sig-prename descclassname">argoverse.utils.grid_interpolation.</code><code class="sig-name descname">interp_square_grid</code><span class="sig-paren">(</span><em class="sig-param">grid_data</em>, <em class="sig-param">in_dim=200</em>, <em class="sig-param">out_dim=30</em>, <em class="sig-param">interp_type='linear'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/grid_interpolation.html#interp_square_grid"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.grid_interpolation.interp_square_grid" title="Permalink to this definition">¶</a></dt>
<dd><p>Interpolate a square grid
Thousands of times faster than scipy.interpolate.interp2d.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>grid_data</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (in_dim,in_dim)</p></li>
<li><p><strong>in_dim</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – integer, representing length of a side of the input square grid</p></li>
<li><p><strong>out_dim</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – integer, representing length of a side of the output square grid</p></li>
<li><p><strong>interp_type</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – string, e.g. ‘linear’ or ‘nearest’ for interpolation scheme</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Numpy array of shape (out_dim,out_dim)</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>interpolated_grid</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.helpers">
<span id="argoverse-utils-helpers-module"></span><h2>argoverse.utils.helpers module<a class="headerlink" href="#module-argoverse.utils.helpers" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="argoverse.utils.helpers.assert_np_array_shape">
<code class="sig-prename descclassname">argoverse.utils.helpers.</code><code class="sig-name descname">assert_np_array_shape</code><span class="sig-paren">(</span><em class="sig-param">array</em>, <em class="sig-param">target_shape</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/helpers.html#assert_np_array_shape"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.helpers.assert_np_array_shape" title="Permalink to this definition">¶</a></dt>
<dd><p>Check for shape correctness.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>array</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – array to check dimensions of.</p></li>
<li><p><strong>target_shape</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Sequence" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sequence</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.7)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]]) – desired shape. use None for unknown dimension sizes.</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#ValueError" title="(in Python v3.7)"><strong>ValueError</strong></a> – if array’s shape does not match target_shape for any of the specified dimensions.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.heuristic_ground_removal">
<span id="argoverse-utils-heuristic-ground-removal-module"></span><h2>argoverse.utils.heuristic_ground_removal module<a class="headerlink" href="#module-argoverse.utils.heuristic_ground_removal" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="argoverse.utils.heuristic_ground_removal.filter_ground_pts_polar_grid_mean_var">
<code class="sig-prename descclassname">argoverse.utils.heuristic_ground_removal.</code><code class="sig-name descname">filter_ground_pts_polar_grid_mean_var</code><span class="sig-paren">(</span><em class="sig-param">lidar_pts</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/heuristic_ground_removal.html#filter_ground_pts_polar_grid_mean_var"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.heuristic_ground_removal.filter_ground_pts_polar_grid_mean_var" title="Permalink to this definition">¶</a></dt>
<dd><p>We divide the world into polar voxels.
We aggregate the height statistics of all of the points that fall into each polar voxel.
If the mean is below a threshold, we call it a ground voxel.
If the z-axis variance is very low, we also call it a ground voxel.</p>
<blockquote>
<div><p>Var(X) = E[X^2] - E[X]^2</p>
</div></blockquote>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>lidar_pts</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – NumPy n-d array of shape (n,3)</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>NumPy n-d array of shape (n,3)</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>non_ground_lidar_pts</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.interpolate">
<span id="argoverse-utils-interpolate-module"></span><h2>argoverse.utils.interpolate module<a class="headerlink" href="#module-argoverse.utils.interpolate" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="argoverse.utils.interpolate.assert_consecutive">
<code class="sig-prename descclassname">argoverse.utils.interpolate.</code><code class="sig-name descname">assert_consecutive</code><span class="sig-paren">(</span><em class="sig-param">shared_dup_inds</em>, <em class="sig-param">num_pts</em>, <em class="sig-param">coords_1d</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/interpolate.html#assert_consecutive"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.interpolate.assert_consecutive" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>shared_dup_inds</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – </p></li>
<li><p><strong>num_pts</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – </p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.interpolate.compute_lane_width">
<code class="sig-prename descclassname">argoverse.utils.interpolate.</code><code class="sig-name descname">compute_lane_width</code><span class="sig-paren">(</span><em class="sig-param">left_even_pts</em>, <em class="sig-param">right_even_pts</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/interpolate.html#compute_lane_width"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.interpolate.compute_lane_width" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute the width of a lane, given an explicit left and right boundary.
Requires an equal number of waypoints on each boundary.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>left_even_pts</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (N,2)</p></li>
<li><p><strong>right_even_pts</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (N,2)</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>float representing average width of a lane</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>lane_width</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.interpolate.compute_mid_pivot_arc">
<code class="sig-prename descclassname">argoverse.utils.interpolate.</code><code class="sig-name descname">compute_mid_pivot_arc</code><span class="sig-paren">(</span><em class="sig-param">single_pt</em>, <em class="sig-param">arc_pts</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/interpolate.html#compute_mid_pivot_arc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.interpolate.compute_mid_pivot_arc" title="Permalink to this definition">¶</a></dt>
<dd><p>Given a line of points on one boundary, and a single point on the other side,
produce the middle arc we get by pivoting around the single point.</p>
<p>Occurs when mapping cul-de-sacs:</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>single_pt</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (2,)</p></li>
<li><p><strong>arc_pts</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (N,2)</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Numpy array of shape (N,3)</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>centerline_pts</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.interpolate.compute_midpoint_line">
<code class="sig-prename descclassname">argoverse.utils.interpolate.</code><code class="sig-name descname">compute_midpoint_line</code><span class="sig-paren">(</span><em class="sig-param">left_ln_bnds</em>, <em class="sig-param">right_ln_bnds</em>, <em class="sig-param">num_interp_pts=10</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/interpolate.html#compute_midpoint_line"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.interpolate.compute_midpoint_line" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute the lane segment centerline by interpolating n points along each
boundary, and then averaging left and right waypoints.</p>
<p>Note that the number of input waypoints along the left and right boundaries
can be vastly different – consider cul-de-sacs, for example.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>left_ln_bnds</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (M,2)</p></li>
<li><p><strong>right_ln_bnds</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (N,2)</p></li>
<li><p><strong>num_interp_pts</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – number of midpoints to compute for this lane segment,
except if it is a cul-de-sac, in which case the number of midpoints
will be equal to max(M,N).</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p></p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>centerline_pts</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.interpolate.eliminate_duplicates_2d">
<code class="sig-prename descclassname">argoverse.utils.interpolate.</code><code class="sig-name descname">eliminate_duplicates_2d</code><span class="sig-paren">(</span><em class="sig-param">px</em>, <em class="sig-param">py</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/interpolate.html#eliminate_duplicates_2d"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.interpolate.eliminate_duplicates_2d" title="Permalink to this definition">¶</a></dt>
<dd><p>We compare indices to ensure that deleted values are exactly
adjacent to each other in the polyline sequence.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>, <a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>]</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.interpolate.get_duplicate_indices_1d">
<code class="sig-prename descclassname">argoverse.utils.interpolate.</code><code class="sig-name descname">get_duplicate_indices_1d</code><span class="sig-paren">(</span><em class="sig-param">coords_1d</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/interpolate.html#get_duplicate_indices_1d"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.interpolate.get_duplicate_indices_1d" title="Permalink to this definition">¶</a></dt>
<dd><p>Given a 1D polyline, remove consecutive duplicate coordinates.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>coords_1d</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – </p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p></p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>dup_vals</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.interpolate.interp_arc">
<code class="sig-prename descclassname">argoverse.utils.interpolate.</code><code class="sig-name descname">interp_arc</code><span class="sig-paren">(</span><em class="sig-param">t</em>, <em class="sig-param">px</em>, <em class="sig-param">py</em>, <em class="sig-param">interp_method='linear'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/interpolate.html#interp_arc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.interpolate.interp_arc" title="Permalink to this definition">¶</a></dt>
<dd><p>Interpolate a polyline using arc-length interpolation.
We remove duplicate consecutive points, since these have zero
distance and thus cause division by zero in chord length computation.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>t</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – number of points that will be uniformly interpolated and returned</p></li>
<li><p><strong>px</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (N,), representing x-coordinates of the arc</p></li>
<li><p><strong>py</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (N,), representing y-coordinates of the arc</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Numpy array of shape (N,2)</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>pt</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.json_utils">
<span id="argoverse-utils-json-utils-module"></span><h2>argoverse.utils.json_utils module<a class="headerlink" href="#module-argoverse.utils.json_utils" title="Permalink to this headline">¶</a></h2>
<p>JSON utility functions.</p>
<dl class="function">
<dt id="argoverse.utils.json_utils.read_json_file">
<code class="sig-prename descclassname">argoverse.utils.json_utils.</code><code class="sig-name descname">read_json_file</code><span class="sig-paren">(</span><em class="sig-param">fpath</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/json_utils.html#read_json_file"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.json_utils.read_json_file" title="Permalink to this definition">¶</a></dt>
<dd><p>Load dictionary from JSON file.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>fpath</strong> – Path to JSON file.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Deserialized Python dictionary.</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.json_utils.save_json_dict">
<code class="sig-prename descclassname">argoverse.utils.json_utils.</code><code class="sig-name descname">save_json_dict</code><span class="sig-paren">(</span><em class="sig-param">json_fpath</em>, <em class="sig-param">dictionary</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/json_utils.html#save_json_dict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.json_utils.save_json_dict" title="Permalink to this definition">¶</a></dt>
<dd><p>Save a Python dictionary to a JSON file.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>json_fpath</strong> – Path to file to create.</p></li>
<li><p><strong>dictionary</strong> – Python dictionary to be serialized.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.line_projection">
<span id="argoverse-utils-line-projection-module"></span><h2>argoverse.utils.line_projection module<a class="headerlink" href="#module-argoverse.utils.line_projection" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="argoverse.utils.line_projection.project_to_line">
<code class="sig-prename descclassname">argoverse.utils.line_projection.</code><code class="sig-name descname">project_to_line</code><span class="sig-paren">(</span><em class="sig-param">trajectory</em>, <em class="sig-param">center_polyline</em>, <em class="sig-param">enforce_same_density=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/line_projection.html#project_to_line"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.line_projection.project_to_line" title="Permalink to this definition">¶</a></dt>
<dd><p>Project a trajectory onto a polyline.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>trajectory</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – An array of shape (N,2) that we will project onto a polyline.</p></li>
<li><p><strong>center_polyline</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – An array of shape (N,2) to project onto.</p></li>
<li><p><strong>enforce_same_density</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – False by default, if set to True, centerline polyline is interpolated to match the point
density of the trajectory.</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>, <a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>]</p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Projected distance along the centerline, Polyline centerline_trajectory.</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.line_projection.project_to_line_seq">
<code class="sig-prename descclassname">argoverse.utils.line_projection.</code><code class="sig-name descname">project_to_line_seq</code><span class="sig-paren">(</span><em class="sig-param">trajectory</em>, <em class="sig-param">lines</em>, <em class="sig-param">interpolate_more=True</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/line_projection.html#project_to_line_seq"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.line_projection.project_to_line_seq" title="Permalink to this definition">¶</a></dt>
<dd><p>Project a trajectory onto a line sequence.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>trajectory</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – An array of shape (N,2) that we will project onto a polyline.</p></li>
<li><p><strong>lines</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Sequence" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sequence</span></code></a>[<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>]) – A sequence of lines.</p></li>
<li><p><strong>interpolate_more</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – True by default.</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>, <a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>]</p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Projected distance along the centerline, Polyline centerline_trajectory.</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.manhattan_search">
<span id="argoverse-utils-manhattan-search-module"></span><h2>argoverse.utils.manhattan_search module<a class="headerlink" href="#module-argoverse.utils.manhattan_search" title="Permalink to this headline">¶</a></h2>
<p>Fast search functions of nearest neighbor based on Manhattan distance.</p>
<dl class="function">
<dt id="argoverse.utils.manhattan_search.compute_point_cloud_bbox">
<code class="sig-prename descclassname">argoverse.utils.manhattan_search.</code><code class="sig-name descname">compute_point_cloud_bbox</code><span class="sig-paren">(</span><em class="sig-param">point_cloud</em>, <em class="sig-param">verbose=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/manhattan_search.html#compute_point_cloud_bbox"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.manhattan_search.compute_point_cloud_bbox" title="Permalink to this definition">¶</a></dt>
<dd><p>Given a set of 2D or 3D points, find the minimum size axis-aligned bounding box in the xy plane (ground plane).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>point_cloud</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – an array of dim (N,3) or (N,2).</p></li>
<li><p><strong>verbose</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – False by default, if set to True, it prints the bounding box dimensions.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>an array of dim (4,) representing x_min, y_min, x_max, y_max.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>bbox</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.manhattan_search.compute_polygon_bboxes">
<code class="sig-prename descclassname">argoverse.utils.manhattan_search.</code><code class="sig-name descname">compute_polygon_bboxes</code><span class="sig-paren">(</span><em class="sig-param">polygons</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/manhattan_search.html#compute_polygon_bboxes"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.manhattan_search.compute_polygon_bboxes" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute the minimum size enclosing xy bounding box for each polygon that is provided as input.
:type polygons: <a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>
:param polygons: an array of type ‘O’ (object) with shape (n,). Each object has shape (m, 3+).</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>a float array with shape (n, 4).</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>polygon_bboxes</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.manhattan_search.find_all_polygon_bboxes_overlapping_query_bbox">
<code class="sig-prename descclassname">argoverse.utils.manhattan_search.</code><code class="sig-name descname">find_all_polygon_bboxes_overlapping_query_bbox</code><span class="sig-paren">(</span><em class="sig-param">polygon_bboxes</em>, <em class="sig-param">query_bbox</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/manhattan_search.html#find_all_polygon_bboxes_overlapping_query_bbox"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.manhattan_search.find_all_polygon_bboxes_overlapping_query_bbox" title="Permalink to this definition">¶</a></dt>
<dd><p>Find all the overlapping polygon bounding boxes.</p>
<dl class="simple">
<dt>Each bounding box has the following structure:</dt><dd><p>bbox = np.array([x_min,y_min,x_max,y_max])</p>
</dd>
</dl>
<p>In 3D space, if the coordinates are equal (polygon bboxes touch), then these are considered overlapping.
We have a guarantee that the cropped image will have any sort of overlap with the zero’th object bounding box
inside of the image e.g. along the x-dimension, either the left or right side of the bounding box lies between the
edges of the query bounding box, or the bounding box completely engulfs the query bounding box.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>polygon_bboxes</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – An array of shape (K,), each array element is a NumPy array of shape (4,) representing
the bounding box for a polygon or point cloud.</p></li>
<li><p><strong>query_bbox</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – An array of shape (4,) representing a 2d axis-aligned bounding box, with order
[min_x,min_y,max_x,max_y].</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>An integer array of shape (K,) representing indices where overlap occurs.</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.manhattan_search.find_local_polygons">
<code class="sig-prename descclassname">argoverse.utils.manhattan_search.</code><code class="sig-name descname">find_local_polygons</code><span class="sig-paren">(</span><em class="sig-param">lane_polygons</em>, <em class="sig-param">lane_bboxes</em>, <em class="sig-param">query_min_x</em>, <em class="sig-param">query_max_x</em>, <em class="sig-param">query_min_y</em>, <em class="sig-param">query_max_y</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/manhattan_search.html#find_local_polygons"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.manhattan_search.find_local_polygons" title="Permalink to this definition">¶</a></dt>
<dd><p>Find local polygons. We always also return indices.</p>
<p>Take a collection of precomputed polygon bounding boxes, and compare with a query bounding box then returns the
polygons that overlap, along with their array indices.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>lane_polygons</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – An array of polygons.</p></li>
<li><p><strong>lane_bboxes</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – An array of shape (K,), each array element is a NumPy array of shape (4,) representing
the bounding box for a polygon or point cloud.</p></li>
<li><p><strong>query_min_x</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) – minimum x coordinate of the query bounding box.</p></li>
<li><p><strong>query_max_x</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) – maximum x coordinate of the query bounding box.</p></li>
<li><p><strong>query_min_y</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) – minimum y coordinate of the query bounding box.</p></li>
<li><p><strong>query_max_y</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) – maximum y coordinate of the query bounding box.</p></li>
<li><p><strong>return_indices</strong> – False by default, if set to True, the overlapping indices are returned along with the
overlapping polygon.</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>, <a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>]</p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Overlapping polygon.
Overlapping indices.</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.manhattan_search.prune_polygons_manhattan_dist">
<code class="sig-prename descclassname">argoverse.utils.manhattan_search.</code><code class="sig-name descname">prune_polygons_manhattan_dist</code><span class="sig-paren">(</span><em class="sig-param">query_pt</em>, <em class="sig-param">points_xyz</em>, <em class="sig-param">query_search_range_manhattan=200</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/manhattan_search.html#prune_polygons_manhattan_dist"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.manhattan_search.prune_polygons_manhattan_dist" title="Permalink to this definition">¶</a></dt>
<dd><p>Prune polygon points based on a search area defined by the manhattan distance.</p>
<p>Take a collection of small point clouds and return only point clouds that fall within a manhattan search radius of
the 2D query point.</p>
<p>Similar to the function above, except query bounding box and polygon bounding boxes are not pre-computed, meaning
they must be computed on fly, which can be quite computationally expensive in a loop.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>query_pt</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy n-d array with dimension (2,) representing xy query location.</p></li>
<li><p><strong>points_xyz</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – An array of shape (n,) of array objects. Each array object could be a 2D or 3D polygon, i.e. of</p></li>
<li><p><strong>shape</strong> (<em>m</em><em>,</em><em>2</em><em>) or </em><em>(</em><em>m</em><em>,</em><em>3</em>) – </p></li>
<li><p><strong>query_search_range_manhattan</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – Side length of query bounding box square which is set to 200 by default.</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>An array pruned xyz point objects of shape (k,). Each array object could be a 2D or 3D polygon, i.e. of shape
(m,2) or (m,3) respectively.</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.mayavi_wrapper">
<span id="argoverse-utils-mayavi-wrapper-module"></span><h2>argoverse.utils.mayavi_wrapper module<a class="headerlink" href="#module-argoverse.utils.mayavi_wrapper" title="Permalink to this headline">¶</a></h2>
<p>This module abstracts the usage of mayavi out of most of the code.</p>
<p>Fundamentally, <cite>mayavi</cite> isn’t fun to install and some users might not care about that functionality so it is an
optional dependency of this package.  In order to support the case of “maybe we have it, maybe we don’t”,
we provide this module that wraps mayavi.mlab.</p>
<p>This module aims to be importable, but you’ll get a <cite>NoMayaviAvailableError</cite> if you try to use
anything on <cite>mayavi_wrapper.mlab</cite> unless you have installed <cite>mayavi</cite> properly.</p>
<dl class="exception">
<dt id="argoverse.utils.mayavi_wrapper.NoMayaviAvailableError">
<em class="property">exception </em><code class="sig-prename descclassname">argoverse.utils.mayavi_wrapper.</code><code class="sig-name descname">NoMayaviAvailableError</code><a class="reference internal" href="_modules/argoverse/utils/mayavi_wrapper.html#NoMayaviAvailableError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.mayavi_wrapper.NoMayaviAvailableError" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/exceptions.html#ImportError" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ImportError</span></code></a></p>
<p>Raised when mayavi is not available but we try to use its functionality.</p>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.mesh_grid">
<span id="argoverse-utils-mesh-grid-module"></span><h2>argoverse.utils.mesh_grid module<a class="headerlink" href="#module-argoverse.utils.mesh_grid" title="Permalink to this headline">¶</a></h2>
<p>Mesh grid utility functions.</p>
<dl class="function">
<dt id="argoverse.utils.mesh_grid.get_mesh_grid_as_point_cloud">
<code class="sig-prename descclassname">argoverse.utils.mesh_grid.</code><code class="sig-name descname">get_mesh_grid_as_point_cloud</code><span class="sig-paren">(</span><em class="sig-param">min_x</em>, <em class="sig-param">max_x</em>, <em class="sig-param">min_y</em>, <em class="sig-param">max_y</em>, <em class="sig-param">downsample_factor=1.0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/mesh_grid.html#get_mesh_grid_as_point_cloud"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.mesh_grid.get_mesh_grid_as_point_cloud" title="Permalink to this definition">¶</a></dt>
<dd><p>Sample regular grid and return the (x, y) coordinates.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>min_x</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – Minimum x-coordinate of 2D grid</p></li>
<li><p><strong>max_x</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – Maximum x-coordinate of 2D grid</p></li>
<li><p><strong>min_y</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – Minimum y-coordinate of 2D grid</p></li>
<li><p><strong>max_y</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – Maximum y-coordinate of 2D grid</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Array of shape (N, 2)</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>pts</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.mpl_plotting_utils">
<span id="argoverse-utils-mpl-plotting-utils-module"></span><h2>argoverse.utils.mpl_plotting_utils module<a class="headerlink" href="#module-argoverse.utils.mpl_plotting_utils" title="Permalink to this headline">¶</a></h2>
<p>Collection of utility functions for Matplotlib.</p>
<dl class="function">
<dt id="argoverse.utils.mpl_plotting_utils.animate_polyline">
<code class="sig-prename descclassname">argoverse.utils.mpl_plotting_utils.</code><code class="sig-name descname">animate_polyline</code><span class="sig-paren">(</span><em class="sig-param">polyline</em>, <em class="sig-param">axes_margin=5</em>, <em class="sig-param">show_plot=True</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/mpl_plotting_utils.html#animate_polyline"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.mpl_plotting_utils.animate_polyline" title="Permalink to this definition">¶</a></dt>
<dd><p>Draw and animate a polyline on a plot.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>polyline</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of shape (N, 2) representing the points of the line</p></li>
<li><p><strong>axes_margin</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – How much margin for the axes</p></li>
<li><p><strong>show_plot</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – Whether to show the plot after rendering it</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.mpl_plotting_utils.draw_lane_polygons">
<code class="sig-prename descclassname">argoverse.utils.mpl_plotting_utils.</code><code class="sig-name descname">draw_lane_polygons</code><span class="sig-paren">(</span><em class="sig-param">ax</em>, <em class="sig-param">lane_polygons</em>, <em class="sig-param">color='y'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/mpl_plotting_utils.html#draw_lane_polygons"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.mpl_plotting_utils.draw_lane_polygons" title="Permalink to this definition">¶</a></dt>
<dd><p>Draw a lane using polygons.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ax</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">Axes</span></code>) – Matplotlib axes</p></li>
<li><p><strong>lane_polygons</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of (N,) objects, where each object is a (M,3) array</p></li>
<li><p><strong>color</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Union" title="(in Python v3.7)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code></a>[<code class="xref py py-class docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>], <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]) – Tuple of shape (3,) representing the RGB color or a single character 3-tuple, e.g. ‘b’</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.mpl_plotting_utils.draw_polygon_mpl">
<code class="sig-prename descclassname">argoverse.utils.mpl_plotting_utils.</code><code class="sig-name descname">draw_polygon_mpl</code><span class="sig-paren">(</span><em class="sig-param">ax</em>, <em class="sig-param">polygon</em>, <em class="sig-param">color</em>, <em class="sig-param">linewidth=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/mpl_plotting_utils.html#draw_polygon_mpl"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.mpl_plotting_utils.draw_polygon_mpl" title="Permalink to this definition">¶</a></dt>
<dd><p>Draw a polygon.</p>
<p>The polygon’s first and last point must be the same (repeated).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ax</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">Axes</span></code>) – Matplotlib axes instance to draw on</p></li>
<li><p><strong>polygon</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of shape (N, 2) or (N, 3)</p></li>
<li><p><strong>color</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Union" title="(in Python v3.7)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code></a>[<code class="xref py py-class docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>], <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]) – Tuple of shape (3,) representing the RGB color or a single character 3-tuple, e.g. ‘b’</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.mpl_plotting_utils.draw_polygonpatch_matplotlib">
<code class="sig-prename descclassname">argoverse.utils.mpl_plotting_utils.</code><code class="sig-name descname">draw_polygonpatch_matplotlib</code><span class="sig-paren">(</span><em class="sig-param">points</em>, <em class="sig-param">color</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/mpl_plotting_utils.html#draw_polygonpatch_matplotlib"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.mpl_plotting_utils.draw_polygonpatch_matplotlib" title="Permalink to this definition">¶</a></dt>
<dd><p>Draw a PolygonPatch.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>points</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Any" title="(in Python v3.7)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Any</span></code></a>) – Unused argument</p></li>
<li><p><strong>color</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Union" title="(in Python v3.7)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code></a>[<code class="xref py py-class docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>], <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]) – Tuple of shape (3,) representing the RGB color or a single character 3-tuple, e.g. ‘b’</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.mpl_plotting_utils.plot_bbox_2D">
<code class="sig-prename descclassname">argoverse.utils.mpl_plotting_utils.</code><code class="sig-name descname">plot_bbox_2D</code><span class="sig-paren">(</span><em class="sig-param">ax</em>, <em class="sig-param">pts</em>, <em class="sig-param">color</em>, <em class="sig-param">linestyle='-'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/mpl_plotting_utils.html#plot_bbox_2D"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.mpl_plotting_utils.plot_bbox_2D" title="Permalink to this definition">¶</a></dt>
<dd><p>Draw a bounding box.</p>
<p>2D bbox vertices should be arranged as:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="mi">0</span><span class="o">----</span><span class="mi">1</span>
<span class="o">|</span>    <span class="o">|</span>
<span class="mi">2</span><span class="o">----</span><span class="mi">3</span>
</pre></div>
</div>
<p>i.e. the connectivity is 0-&gt;1, 1-&gt;3, 3-&gt;2, 2-&gt;0</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ax</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">Axes</span></code>) – Matplotlib axes</p></li>
<li><p><strong>pts</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of shape (4, 2) representing the 4 points of the bounding box.</p></li>
<li><p><strong>color</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Union" title="(in Python v3.7)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code></a>[<code class="xref py py-class docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>], <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]) – Tuple of shape (3,) representing the RGB color or a single character 3-tuple, e.g. ‘b’</p></li>
<li><p><strong>linestyle</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – The linestyle to use</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.mpl_plotting_utils.plot_lane_segment_patch">
<code class="sig-prename descclassname">argoverse.utils.mpl_plotting_utils.</code><code class="sig-name descname">plot_lane_segment_patch</code><span class="sig-paren">(</span><em class="sig-param">polygon_pts</em>, <em class="sig-param">ax</em>, <em class="sig-param">color='y'</em>, <em class="sig-param">alpha=0.3</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/mpl_plotting_utils.html#plot_lane_segment_patch"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.mpl_plotting_utils.plot_lane_segment_patch" title="Permalink to this definition">¶</a></dt>
<dd><p>Plot a lane segment using a PolygonPatch.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>polygon_pts</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of shape (N, 2) representing the points of the polygon</p></li>
<li><p><strong>ax</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">Axes</span></code>) – Matplotlib axes</p></li>
<li><p><strong>color</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Union" title="(in Python v3.7)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code></a>[<code class="xref py py-class docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>], <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]) – Tuple of shape (3,) representing the RGB color or a single character 3-tuple, e.g. ‘b’</p></li>
<li><p><strong>alpha</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) – the opacity of the lane segment</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.mpl_plotting_utils.plot_nearby_centerlines">
<code class="sig-prename descclassname">argoverse.utils.mpl_plotting_utils.</code><code class="sig-name descname">plot_nearby_centerlines</code><span class="sig-paren">(</span><em class="sig-param">lane_centerlines</em>, <em class="sig-param">ax</em>, <em class="sig-param">nearby_lane_ids</em>, <em class="sig-param">color</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/mpl_plotting_utils.html#plot_nearby_centerlines"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.mpl_plotting_utils.plot_nearby_centerlines" title="Permalink to this definition">¶</a></dt>
<dd><p>Plot centerlines.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>lane_centerlines</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Dict" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Any" title="(in Python v3.7)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Any</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Any" title="(in Python v3.7)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Any</span></code></a>]) – Python dictionary where key is lane ID, value is object describing the lane</p></li>
<li><p><strong>ax</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">Axes</span></code>) – Matplotlib axes</p></li>
<li><p><strong>nearby_lane_ids</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.List" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">List</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]) – List of integers representing lane IDs</p></li>
<li><p><strong>color</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Union" title="(in Python v3.7)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code></a>[<code class="xref py py-class docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>], <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]) – Tuple of shape (3,) representing the RGB color or a single character 3-tuple, e.g. ‘b’</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.mpl_plotting_utils.visualize_centerline">
<code class="sig-prename descclassname">argoverse.utils.mpl_plotting_utils.</code><code class="sig-name descname">visualize_centerline</code><span class="sig-paren">(</span><em class="sig-param">centerline</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/mpl_plotting_utils.html#visualize_centerline"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.mpl_plotting_utils.visualize_centerline" title="Permalink to this definition">¶</a></dt>
<dd><p>Visualize the computed centerline.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>centerline</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">LineString</span></code>) – Sequence of coordinates forming the centerline</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.pkl_utils">
<span id="argoverse-utils-pkl-utils-module"></span><h2>argoverse.utils.pkl_utils module<a class="headerlink" href="#module-argoverse.utils.pkl_utils" title="Permalink to this headline">¶</a></h2>
<p>Pickle utility functions.</p>
<dl class="function">
<dt id="argoverse.utils.pkl_utils.load_pkl_dictionary">
<code class="sig-prename descclassname">argoverse.utils.pkl_utils.</code><code class="sig-name descname">load_pkl_dictionary</code><span class="sig-paren">(</span><em class="sig-param">pkl_fpath</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/pkl_utils.html#load_pkl_dictionary"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.pkl_utils.load_pkl_dictionary" title="Permalink to this definition">¶</a></dt>
<dd><p>Load a Python dictionary from a file serialized by pickle.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>pkl_fpath</strong> – Path to pickle file.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Deserialized Python dictionary.</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.pkl_utils.save_pkl_dictionary">
<code class="sig-prename descclassname">argoverse.utils.pkl_utils.</code><code class="sig-name descname">save_pkl_dictionary</code><span class="sig-paren">(</span><em class="sig-param">pkl_fpath</em>, <em class="sig-param">dictionary</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/pkl_utils.html#save_pkl_dictionary"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.pkl_utils.save_pkl_dictionary" title="Permalink to this definition">¶</a></dt>
<dd><p>Save a Python dictionary to a file using pickle.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>pkl_fpath</strong> – Path to file to create.</p></li>
<li><p><strong>dictionary</strong> – Python dictionary to be serialized.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.plane_visualization_utils">
<span id="argoverse-utils-plane-visualization-utils-module"></span><h2>argoverse.utils.plane_visualization_utils module<a class="headerlink" href="#module-argoverse.utils.plane_visualization_utils" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="argoverse.utils.plane_visualization_utils.generate_grid_on_plane">
<code class="sig-prename descclassname">argoverse.utils.plane_visualization_utils.</code><code class="sig-name descname">generate_grid_on_plane</code><span class="sig-paren">(</span><em class="sig-param">a</em>, <em class="sig-param">b</em>, <em class="sig-param">c</em>, <em class="sig-param">d</em>, <em class="sig-param">P</em>, <em class="sig-param">radius=15</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/plane_visualization_utils.html#generate_grid_on_plane"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.plane_visualization_utils.generate_grid_on_plane" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>a</strong><strong>,</strong><strong>b</strong><strong>,</strong><strong>c</strong><strong>,</strong><strong>d</strong> – Coefficients of <code class="docutils literal notranslate"><span class="pre">ax</span> <span class="pre">+</span> <span class="pre">by</span> <span class="pre">+</span> <span class="pre">cz</span> <span class="pre">=</span> <span class="pre">d</span></code> defining plane</p></li>
<li><p><strong>P</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (3,) representing point on the plane</p></li>
<li><p><strong>radius</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) – Radius (default 15)</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Numpy array of shape (N,3) with points on the input plane</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>plane_pts</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.plane_visualization_utils.get_perpendicular">
<code class="sig-prename descclassname">argoverse.utils.plane_visualization_utils.</code><code class="sig-name descname">get_perpendicular</code><span class="sig-paren">(</span><em class="sig-param">n</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/plane_visualization_utils.html#get_perpendicular"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.plane_visualization_utils.get_perpendicular" title="Permalink to this definition">¶</a></dt>
<dd><p>n guarantees that dot(n, getPerpendicular(n)) is zero, which is the
orthogonality condition, while also keeping the magnitude of the vector
as high as possible. Note that setting the component with the smallest
magnitude to 0 also guarantees that you don’t get a 0,0,0 vector as a
result, unless that is already your input.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>n</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (3,)</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Numpy array of shape (3,)</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>result</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.plane_visualization_utils.plot_frustum_planes_and_normals">
<code class="sig-prename descclassname">argoverse.utils.plane_visualization_utils.</code><code class="sig-name descname">plot_frustum_planes_and_normals</code><span class="sig-paren">(</span><em class="sig-param">planes</em>, <em class="sig-param">cuboid_verts=None</em>, <em class="sig-param">near_clip_dist=0.5</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/plane_visualization_utils.html#plot_frustum_planes_and_normals"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.plane_visualization_utils.plot_frustum_planes_and_normals" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>planes</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Sequence" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sequence</span></code></a>[<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>]) – list of length 5. Each list element is a Numpy array
of shape (4,) representing the equation of a plane,
e.g. (a,b,c,d) in ax+by+cz=d</p></li>
<li><p><strong>cuboid_verts</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.7)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>]) – Numpy array of shape (N,3) representing
cuboid vertices</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>None</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.plane_visualization_utils.populate_frustum_voxels">
<code class="sig-prename descclassname">argoverse.utils.plane_visualization_utils.</code><code class="sig-name descname">populate_frustum_voxels</code><span class="sig-paren">(</span><em class="sig-param">planes</em>, <em class="sig-param">fig</em>, <em class="sig-param">axis_pair</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/plane_visualization_utils.html#populate_frustum_voxels"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.plane_visualization_utils.populate_frustum_voxels" title="Permalink to this definition">¶</a></dt>
<dd><p>Generate grid in xy plane, and then treat it as grid in xz (ground) plane
in camera coordinate system.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>planes</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Sequence" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sequence</span></code></a>[<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>]) – list of length 5. Each list element is a Numpy array
of shape (4,) representing the equation of a plane,
e.g. (a,b,c,d) in ax+by+cz=d</p></li>
<li><p><strong>fig</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Any" title="(in Python v3.7)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Any</span></code></a>) – Mayavi figure to draw on</p></li>
<li><p><strong>axis_pair</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – Either “xz” or “yz”</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Any" title="(in Python v3.7)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Any</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Mayavi figure</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.ply_loader">
<span id="argoverse-utils-ply-loader-module"></span><h2>argoverse.utils.ply_loader module<a class="headerlink" href="#module-argoverse.utils.ply_loader" title="Permalink to this headline">¶</a></h2>
<p>Point cloud loading utility functions.</p>
<dl class="function">
<dt id="argoverse.utils.ply_loader.load_ply">
<code class="sig-prename descclassname">argoverse.utils.ply_loader.</code><code class="sig-name descname">load_ply</code><span class="sig-paren">(</span><em class="sig-param">ply_fpath</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/ply_loader.html#load_ply"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.ply_loader.load_ply" title="Permalink to this definition">¶</a></dt>
<dd><p>Load a point cloud file from a filepath.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>ply_fpath</strong> – Path to a PLY file</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Array of shape (N, 3)</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>arr</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.polyline_density">
<span id="argoverse-utils-polyline-density-module"></span><h2>argoverse.utils.polyline_density module<a class="headerlink" href="#module-argoverse.utils.polyline_density" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="argoverse.utils.polyline_density.get_polyline_length">
<code class="sig-prename descclassname">argoverse.utils.polyline_density.</code><code class="sig-name descname">get_polyline_length</code><span class="sig-paren">(</span><em class="sig-param">polyline</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/polyline_density.html#get_polyline_length"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.polyline_density.get_polyline_length" title="Permalink to this definition">¶</a></dt>
<dd><p>Calculate the length of a polyline.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>polyline</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (N,2)</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The length of the polyline as a scalar</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.polyline_density.interpolate_polyline_to_ref_density">
<code class="sig-prename descclassname">argoverse.utils.polyline_density.</code><code class="sig-name descname">interpolate_polyline_to_ref_density</code><span class="sig-paren">(</span><em class="sig-param">polyline_to_interp</em>, <em class="sig-param">ref_polyline</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/polyline_density.html#interpolate_polyline_to_ref_density"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.polyline_density.interpolate_polyline_to_ref_density" title="Permalink to this definition">¶</a></dt>
<dd><p>Interpolate a polyline so that its density matches the density of a reference polyline.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>     <span class="n">ref_l2</span>             <span class="n">query_l2</span>
<span class="o">----------------</span>  <span class="o">=</span>  <span class="o">--------------</span>
<span class="n">NUM_PTS_PER_TRAJ</span>      <span class="n">num_interp_pts</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>polyline_to_interp</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Polyline to interpolate – numpy array of shape (M,2)</p></li>
<li><p><strong>ref_polyline</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Reference polyline – numpy array of shape (N,2)</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Interpolated polyline – numpy array of shape (K,2)</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="argoverse.utils.polyline_density.traverse_polyline_by_specific_dist">
<code class="sig-prename descclassname">argoverse.utils.polyline_density.</code><code class="sig-name descname">traverse_polyline_by_specific_dist</code><span class="sig-paren">(</span><em class="sig-param">polyline_to_walk</em>, <em class="sig-param">l2_dist_to_walk</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/polyline_density.html#traverse_polyline_by_specific_dist"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.polyline_density.traverse_polyline_by_specific_dist" title="Permalink to this definition">¶</a></dt>
<dd><p>Walk a distance along a polyline, and return the points along which you walked.</p>
<p>Assumption: polyline is much longer than the distance to walk.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>polyline_to_walk</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (N,2)</p></li>
<li><p><strong>l2_dist_to_walk</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) – Distance to traverse</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>]</p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Tuple of (polyline, success flag)</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.se2">
<span id="argoverse-utils-se2-module"></span><h2>argoverse.utils.se2 module<a class="headerlink" href="#module-argoverse.utils.se2" title="Permalink to this headline">¶</a></h2>
<p>Module for <cite>SE2</cite>.</p>
<dl class="class">
<dt id="argoverse.utils.se2.SE2">
<em class="property">class </em><code class="sig-prename descclassname">argoverse.utils.se2.</code><code class="sig-name descname">SE2</code><span class="sig-paren">(</span><em class="sig-param">rotation</em>, <em class="sig-param">translation</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/se2.html#SE2"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.se2.SE2" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<dl class="method">
<dt id="argoverse.utils.se2.SE2.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">rotation</em>, <em class="sig-param">translation</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/se2.html#SE2.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.se2.SE2.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Initialize.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>rotation</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – np.ndarray of shape (2,2).</p></li>
<li><p><strong>translation</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – np.ndarray of shape (2,1).</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#ValueError" title="(in Python v3.7)"><strong>ValueError</strong></a> – if rotation or translation do not have the required shapes.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="argoverse.utils.se2.SE2.inverse">
<code class="sig-name descname">inverse</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/se2.html#SE2.inverse"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.se2.SE2.inverse" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the inverse of the current SE2 transformation.</p>
<p>For example, if the current object represents target_SE2_src, we will return instead src_SE2_target.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><a class="reference internal" href="#argoverse.utils.se2.SE2" title="argoverse.utils.se2.SE2"><code class="xref py py-class docutils literal notranslate"><span class="pre">SE2</span></code></a></p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>inverse of this SE2 transformation.</p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="argoverse.utils.se2.SE2.inverse_transform_point_cloud">
<code class="sig-name descname">inverse_transform_point_cloud</code><span class="sig-paren">(</span><em class="sig-param">point_cloud</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/se2.html#SE2.inverse_transform_point_cloud"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.se2.SE2.inverse_transform_point_cloud" title="Permalink to this definition">¶</a></dt>
<dd><p>Transform the point_cloud by the inverse of this SE2.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>point_cloud</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Numpy array of shape (N,2).</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>point_cloud transformed by the inverse of this SE2.</p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="argoverse.utils.se2.SE2.right_multiply_with_se2">
<code class="sig-name descname">right_multiply_with_se2</code><span class="sig-paren">(</span><em class="sig-param">right_se2</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/se2.html#SE2.right_multiply_with_se2"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.se2.SE2.right_multiply_with_se2" title="Permalink to this definition">¶</a></dt>
<dd><p>Multiply this SE2 from right by right_se2 and return the composed transformation.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>right_se2</strong> (<a class="reference internal" href="#argoverse.utils.se2.SE2" title="argoverse.utils.se2.SE2"><code class="xref py py-class docutils literal notranslate"><span class="pre">SE2</span></code></a>) – SE2 object to multiply this object by from right.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#argoverse.utils.se2.SE2" title="argoverse.utils.se2.SE2"><code class="xref py py-class docutils literal notranslate"><span class="pre">SE2</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The composed transformation.</p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="argoverse.utils.se2.SE2.transform_point_cloud">
<code class="sig-name descname">transform_point_cloud</code><span class="sig-paren">(</span><em class="sig-param">point_cloud</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/se2.html#SE2.transform_point_cloud"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.se2.SE2.transform_point_cloud" title="Permalink to this definition">¶</a></dt>
<dd><p>Apply the SE(2) transformation to point_cloud.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>point_cloud</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – np.ndarray of shape (N, 2).</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>np.ndarray of shape (N, 2).</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>transformed_point_cloud</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#ValueError" title="(in Python v3.7)"><strong>ValueError</strong></a> – if point_cloud does not have the required shape.</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.se3">
<span id="argoverse-utils-se3-module"></span><h2>argoverse.utils.se3 module<a class="headerlink" href="#module-argoverse.utils.se3" title="Permalink to this headline">¶</a></h2>
<p>SE3 class for point cloud rotation and translation.</p>
<dl class="class">
<dt id="argoverse.utils.se3.SE3">
<em class="property">class </em><code class="sig-prename descclassname">argoverse.utils.se3.</code><code class="sig-name descname">SE3</code><span class="sig-paren">(</span><em class="sig-param">rotation</em>, <em class="sig-param">translation</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/se3.html#SE3"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.se3.SE3" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<p>An SE3 class allows point cloud rotation and translation operations.</p>
<dl class="method">
<dt id="argoverse.utils.se3.SE3.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">rotation</em>, <em class="sig-param">translation</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/se3.html#SE3.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.se3.SE3.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Initialize an SE3 instance with its rotation and translation matrices.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>rotation</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of shape (3, 3)</p></li>
<li><p><strong>translation</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of shape (3,)</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="argoverse.utils.se3.SE3.inverse">
<code class="sig-name descname">inverse</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/se3.html#SE3.inverse"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.se3.SE3.inverse" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the inverse of the current SE3 transformation.</p>
<p>For example, if the current object represents target_SE3_src, we will return instead src_SE3_target.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><dl class="simple">
<dt>instance of SE3 class, representing</dt><dd><p>inverse of SE3 transformation target_SE3_src</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>src_SE3_target</p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="argoverse.utils.se3.SE3.inverse_transform_point_cloud">
<code class="sig-name descname">inverse_transform_point_cloud</code><span class="sig-paren">(</span><em class="sig-param">point_cloud</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/se3.html#SE3.inverse_transform_point_cloud"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.se3.SE3.inverse_transform_point_cloud" title="Permalink to this definition">¶</a></dt>
<dd><p>Undo the translation and then the rotation (Inverse SE(3) transformation).</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a></p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="argoverse.utils.se3.SE3.right_multiply_with_se3">
<code class="sig-name descname">right_multiply_with_se3</code><span class="sig-paren">(</span><em class="sig-param">right_se3</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/se3.html#SE3.right_multiply_with_se3"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.se3.SE3.right_multiply_with_se3" title="Permalink to this definition">¶</a></dt>
<dd><p>Right multiply the transformation matrix with another SE3 instance.</p>
<p>Algebraic representation: chained_se3 = T * right_se3</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>right_se3</strong> (<a class="reference internal" href="#argoverse.utils.se3.SE3" title="argoverse.utils.se3.SE3"><code class="xref py py-class docutils literal notranslate"><span class="pre">SE3</span></code></a>) – instance of SE3 class</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>instance of SE3 class</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>chained_se3</p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="argoverse.utils.se3.SE3.transform_point_cloud">
<code class="sig-name descname">transform_point_cloud</code><span class="sig-paren">(</span><em class="sig-param">point_cloud</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/se3.html#SE3.transform_point_cloud"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.se3.SE3.transform_point_cloud" title="Permalink to this definition">¶</a></dt>
<dd><p>Apply the SE(3) transformation to this point cloud.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>point_cloud</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of shape (N, 3)</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Array of shape (N, 3)</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>transformed_point_cloud</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.subprocess_utils">
<span id="argoverse-utils-subprocess-utils-module"></span><h2>argoverse.utils.subprocess_utils module<a class="headerlink" href="#module-argoverse.utils.subprocess_utils" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="argoverse.utils.subprocess_utils.run_command">
<code class="sig-prename descclassname">argoverse.utils.subprocess_utils.</code><code class="sig-name descname">run_command</code><span class="sig-paren">(</span><em class="sig-param">cmd</em>, <em class="sig-param">return_output=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/subprocess_utils.html#run_command"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.subprocess_utils.run_command" title="Permalink to this definition">¶</a></dt>
<dd><p>Block until system call completes</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>cmd</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – string, representing shell command</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.7)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<code class="xref py py-class docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>]]</p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Tuple of (stdout, stderr) output if return_output is True, else None</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils.transform">
<span id="argoverse-utils-transform-module"></span><h2>argoverse.utils.transform module<a class="headerlink" href="#module-argoverse.utils.transform" title="Permalink to this headline">¶</a></h2>
<p>Utility functions for converting quaternions to 3d rotation matrices.</p>
<p>Unit quaternions are a way to compactly represent 3D rotations
while avoiding singularities or discontinuities (e.g. gimbal lock).</p>
<p>We require that the quaternions are normalized beforehand to be unit-length.</p>
<dl class="function">
<dt id="argoverse.utils.transform.quat2rotmat">
<code class="sig-prename descclassname">argoverse.utils.transform.</code><code class="sig-name descname">quat2rotmat</code><span class="sig-paren">(</span><em class="sig-param">q</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/argoverse/utils/transform.html#quat2rotmat"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#argoverse.utils.transform.quat2rotmat" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert a unit-length quaternion into a rotation matrix.</p>
<p>Note that libraries such as Scipy expect a quaternion in scalar-last [x, y, z, w] format,
whereas at Argo we work with scalar-first [w, x, y, z] format, so we convert between the
two formats here. We use the [w, x, y, z] order because this corresponds to the
multidimensional complex number <cite>w + ix + jy + kz</cite>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>q</strong> (<a class="reference external" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.16)"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code></a>) – Array of shape (4,) representing (w, x, y, z) coordinates</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Array of shape (3, 3) representing a rotation matrix.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>R</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-argoverse.utils">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-argoverse.utils" title="Permalink to this headline">¶</a></h2>
</div>
</div>


           </div>
           
          </div>
          <footer>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2019, Argo AI, LLC

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>